Amazon Elastic Compute Cloud
API Reference (API Version 2013-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did 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, see Route Tables in the Amazon Virtual Private Cloud User Guide.

Request Parameters

RouteTableId

The ID of the route table.

Type: String

Default: None

Required: Yes

SubnetId

The ID of the subnet.

Type: String

Default: None

Required: Yes

Response Elements

The following elements are returned in an AssociateRouteTableResponse element.

requestId

The ID of the request.

Type: xsd:string

associationId

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

Type: xsd:string

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/2013-02-01/">
   <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> 
   <associationId>rtbassoc-f8ad4891</associationId>
</AssociateRouteTableResponse>