Amazon Elastic Compute Cloud
API Reference (API Version 2012-04-01)
Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to DiggDid this page help you?  Yes  No   Tell us about it...

AssociateRouteTable

Description

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. The action returns an association ID, which you need if you want to disassociate the route table from the subnet later. A route table can be associated with multiple subnets.

For more information about route tables, go to Route Tables in the Amazon Virtual Private Cloud User Guide.

Request Parameters

NameDescriptionRequired

RouteTableId

The ID of the route table.

Type: String

Default: None

Yes

SubnetId

The ID of the subnet.

Type: String

Default: None

Yes

Response Elements

The elements in the following table are wrapped in an AssociateRouteTableResponse structure.

NameDescription

requestId

The ID of the request.

Type: String

associationId

ID that AWS provides to represent the association of the route table and the subnet.

Type: String

Example: rtbassoc-f8ad4891

Examples

Example Request

This example associates a route table with ID rtb-e4ad488d with a subnet with ID subnet-15ad487c.

https://ec2.amazonaws.com/?Action=AssociateRouteTable
&RouteTableId=rtb-e4ad488d
&SubnetId=subnet-15ad487c

Example Response

<AssociateRouteTableResponse xmlns="http://ec2.amazonaws.com/doc/2012-04-01/">
   <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> 
   <associationId>rtbassoc-f8ad4891</associationId>
</AssociateRouteTableResponse>