Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::EC2::VPCGatewayAttachment

Attaches a gateway to a VPC.

Syntax


{
   "Type" : "AWS::EC2::VPCGatewayAttachment",
   "Properties" : {
      "InternetGatewayId" : String,
      "VpcId" : String,
      "VpnGatewayId" : String
   }
}     

Properties

InternetGatewayId

The ID of the Internet gateway.

Required: Conditional You must specify either InternetGatewayId or VpnGatewayId, but not both.

Type: String

Update requires: No interruption

VpcId

The ID of the VPC to associate with this gateway.

Required: Yes

Type: String

Update requires: No interruption

VpnGatewayId

The ID of the virtual private network (VPN) gateway to attach to the VPC.

Required: Conditional You must specify either InternetGatewayId or VpnGatewayId, but not both.

Type: String

Update requires: No interruption

Return Values

Ref

When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the resource name.

For more information about using the Ref function, see Ref.

Examples

Example Attaching both an Internet gateway and a VPN gateway to a VPC

To attach both an Internet gateway and a VPN gateway to a VPC, you must specify two separate AWS::EC2::VPCGatewayAttachment resources:


"AttachGateway" : {
   "Type" : "AWS::EC2::VPCGatewayAttachment",
   "Properties" : {
      "VpcId" : { "Ref" : "VPC" },
      "InternetGatewayId" : { "Ref" : "myInternetGateway" }
   }
},

"AttachVpnGateway" : {
   "Type" : "AWS::EC2::VPCGatewayAttachment",
   "Properties" : {
      "VpcId" : { "Ref" : "VPC" },
      "VpnGatewayId" : { "Ref" : "myVPNGateway" }
   }
},       

See Also