AWS CloudFormation
User Guide (Version )

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.


Associates a subnet with a route table. The subnet and route table must be in the same VPC. This association causes traffic originating from the subnet to be routed according to the routes in the route table. A route table can be associated with multiple subnets.


To declare this entity in your AWS CloudFormation template, use the following syntax:


{ "Type" : "AWS::EC2::SubnetRouteTableAssociation", "Properties" : { "RouteTableId" : String, "SubnetId" : String } }


Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: String SubnetId: String



The ID of the route table.

The physical ID changes when the route table ID is changed.

Required: Yes

Type: String

Update requires: No interruption


The ID of the subnet.

Required: Yes

Type: String

Update requires: Replacement

Return Values


When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the ID of the subnet route table association.

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


Subnet Route Table Association

The following example associates a subnet with a route table.


"mySubnetRouteTableAssociation" : { "Type" : "AWS::EC2::SubnetRouteTableAssociation", "Properties" : { "SubnetId" : { "Ref" : "mySubnet" }, "RouteTableId" : { "Ref" : "myRouteTable" } } }


mySubnetRouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: SubnetId: Ref: mySubnet RouteTableId: Ref: myRouteTable

See Also