CreateTransitGatewayVpcAttachment - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).


Attaches the specified VPC to the specified transit gateway.

If you attach a VPC with a CIDR range that overlaps the CIDR range of a VPC that is already attached, the new VPC CIDR range is not propagated to the default propagation route table.

To send VPC traffic to an attached transit gateway, add a route to the VPC route table using CreateRoute.

Request Parameters

The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.


Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Type: Boolean

Required: No


The VPC attachment options.

Type: CreateTransitGatewayVpcAttachmentRequestOptions object

Required: No


The IDs of one or more subnets. You can specify only one subnet per Availability Zone. You must specify at least one subnet, but we recommend that you specify two subnets for better availability. The transit gateway uses one IP address from each specified subnet.

Type: Array of strings

Required: Yes


The tags to apply to the VPC attachment.

Type: Array of TagSpecification objects

Required: No


The ID of the transit gateway.

Type: String

Required: Yes


The ID of the VPC.

Type: String

Required: Yes

Response Elements

The following elements are returned by the service.


The ID of the request.

Type: String


Information about the VPC attachment.

Type: TransitGatewayVpcAttachment object


For information about the errors that are common to all actions, see Common client error codes.



This example creates a transit gateway VPC attachment for the specified transit gateway.

Sample Request &TransitGatewayId=tgw-02f776b1a7EXAMPLE &VpcID=vpc-0065acced4EXAMPLE &SubnetIds.1=subnet-0187aff814EXAMPLE &Options.DnsSupport=enable &Options.Ipv6Support=disable &AUTHPARAMS

Sample Response

<CreateTransitGatewayVpcAttachmentResponse xmlns=""> <requestId>374ab4fd-5ccd-4d98-93f5-034c80f67d79</requestId> <transitGatewayVpcAttachment> <creationTime>2019-07-17T16:04:27.000Z</creationTime> <options> <dnsSupport>enable</dnsSupport> <ipv6Support>disable</ipv6Support> </options> <state>pending</state> <subnetIds> <item>subnet-0187aff814EXAMPLE</item> </subnetIds> <transitGatewayAttachmentId>tgw-attach-0d2c54bdb3EXAMPLE</transitGatewayAttachmentId> <transitGatewayId>tgw-02f776b1a7EXAMPLE</transitGatewayId> <vpcId>vpc-0065acced4EXAMPLE</vpcId> <vpcOwnerId>111122223333</vpcOwnerId> </transitGatewayVpcAttachment> </CreateTransitGatewayVpcAttachmentResponse>

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: