VpcAttachment
The VpcAttachment resource allows you to manage Virtual Private Cloud (VPC) attachments within AWS Network Manager. For more details, refer to the AWS NetworkManager VpcAttachments documentation.
Minimal Example
Section titled “Minimal Example”Create a basic VPC attachment with required properties and one optional property.
import AWS from "alchemy/aws/control";
const vpcAttachment = await AWS.NetworkManager.VpcAttachment("myVpcAttachment", { SubnetArns: [ "arn:aws:ec2:us-west-2:123456789012:subnet/subnet-0abcd1234efgh5678", "arn:aws:ec2:us-west-2:123456789012:subnet/subnet-1abcd1234efgh5678" ], CoreNetworkId: "cn-0abcd1234efgh5678", VpcArn: "arn:aws:ec2:us-west-2:123456789012:vpc/vpc-0abcd1234efgh5678", Options: { // Optional properties can be added here Autonomous: true }});
Advanced Configuration
Section titled “Advanced Configuration”Configure a VPC attachment with additional properties for advanced use cases.
const advancedVpcAttachment = await AWS.NetworkManager.VpcAttachment("advancedVpcAttachment", { SubnetArns: [ "arn:aws:ec2:us-west-2:123456789012:subnet/subnet-0abcd1234efgh5678" ], CoreNetworkId: "cn-0abcd1234efgh5678", VpcArn: "arn:aws:ec2:us-west-2:123456789012:vpc/vpc-0abcd1234efgh5678", ProposedSegmentChange: { SegmentName: "mySegment", SegmentId: "seg-0abcd1234efgh5678" }, ProposedNetworkFunctionGroupChange: { NetworkFunctionGroupId: "nfg-0abcd1234efgh5678", NetworkFunctionGroupName: "myNetworkFunctionGroup" }, Tags: [ { Key: "Environment", Value: "Production" }, { Key: "Project", Value: "MyProject" } ]});
Adoption of Existing Resources
Section titled “Adoption of Existing Resources”Use the adopt flag to adopt an existing VPC attachment instead of failing if it already exists.
const adoptVpcAttachment = await AWS.NetworkManager.VpcAttachment("adoptVpcAttachment", { SubnetArns: [ "arn:aws:ec2:us-west-2:123456789012:subnet/subnet-0abcd1234efgh5678" ], CoreNetworkId: "cn-0abcd1234efgh5678", VpcArn: "arn:aws:ec2:us-west-2:123456789012:vpc/vpc-0abcd1234efgh5678", adopt: true // Adopt existing resource});