Skip to content
v2.274.0

Experimental

@aws-cdk/aws-ec2-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

AttachVpcOptions Struct ​

Options for creating an Attachment via the attachVpc() method.

Example ​

ts
const transitGateway = new TransitGateway(this, 'MyTransitGateway');
const routeTable = transitGateway.addRouteTable('CustomRouteTable');

const myVpc = new VpcV2(this, 'Vpc');
const subnet = new SubnetV2(this, 'Subnet', {
  vpc: myVpc,
  availabilityZone: 'eu-west-2a',
  ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
  subnetType: SubnetType.PUBLIC
});

const attachment = transitGateway.attachVpc('VpcAttachment', {
  vpc: myVpc,
  subnets: [subnet]
});

// Add a static route to direct traffic
routeTable.addRoute('StaticRoute', attachment, '10.0.0.0/16');

// Block unwanted traffic with a blackhole route
routeTable.addBlackholeRoute('BlackholeRoute', '172.16.0.0/16');

Properties ​

associationRouteTableoptionalITransitGatewayRouteTableassociation_route_tableoptionalITransitGatewayRouteTableassociationRouteTableoptionalITransitGatewayRouteTableAssociationRouteTableoptionalITransitGatewayRouteTableAssociationRouteTableoptionalITransitGatewayRouteTable#
An optional route table to associate with this VPC attachment.

Default: No associations will be created unless it is for the default route table and automatic association is enabled.

propagationRouteTablesoptionalITransitGatewayRouteTable[]propagation_route_tablesoptionaltyping.List[ITransitGatewayRouteTable]propagationRouteTablesoptionalList<ITransitGatewayRouteTable>PropagationRouteTablesoptionalITransitGatewayRouteTable[]PropagationRouteTablesoptional*[]ITransitGatewayRouteTable#
A list of optional route tables to propagate routes to.

Default: No propagations will be created unless it is for the default route table and automatic propagation is enabled.

subnetsISubnet[]subnetstyping.List[ISubnet]subnetsList<ISubnet>SubnetsISubnet[]Subnets*[]ISubnetrequired#
A list of one or more subnets to place the attachment in.

It is recommended to specify more subnets for better availability.

transitGatewayAttachmentNameoptionalstringtransit_gateway_attachment_nameoptionalstrtransitGatewayAttachmentNameoptionalStringTransitGatewayAttachmentNameoptionalstringTransitGatewayAttachmentNameoptional*string#
Physical name of this Transit Gateway VPC Attachment.

Default: Assigned by CloudFormation.

vpcIVpcvpcIVpcvpcIVpcVpcIVpcVpcIVpcrequired#
A VPC attachment(s) will get assigned to.
vpcAttachmentOptionsoptionalITransitGatewayVpcAttachmentOptionsvpc_attachment_optionsoptionalITransitGatewayVpcAttachmentOptionsvpcAttachmentOptionsoptionalITransitGatewayVpcAttachmentOptionsVpcAttachmentOptionsoptionalITransitGatewayVpcAttachmentOptionsVpcAttachmentOptionsoptionalITransitGatewayVpcAttachmentOptions#
The VPC attachment options.

Default: All options are disabled.