| Did this page help you? Yes No Tell us about it... |
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.
The short version of this command is ec2assocrtb.
ec2-associate-route-table
route_table_id -s subnet_id
| Name | Description | Required |
|---|---|---|
|
|
The ID of the route table. Type: String Default: None Example: rtb-6aa34603 |
Yes |
|
|
The ID of the subnet. Type: String Default: None Example: -s subnet-92a045fb |
Yes |
| Option | Description |
|---|---|
|
|
Overrides the Region specified in the Default: The Example: |
|
|
Default: The Example: |
|
|
The private key to use when constructing requests to Amazon EC2. Default: The value of the Example: |
|
|
The X.509 certificate to use when constructing requests to Amazon EC2. Default: The value of the Example: |
|
|
Specifies a connection timeout (in seconds). Example: --connection-timeout 30 |
|
|
Specifies a request timeout (in seconds). Example: --request-timeout 45 |
|
|
Displays verbose output by showing the SOAP request and response on the command line. This is particularly useful if you are building tools to talk directly to our SOAP API. |
|
|
Displays column headers in the output. |
|
|
Shows empty columns as |
|
|
Do not display tags for tagged resources. |
|
|
Prints internal debugging information. This is useful to assist us when troubleshooting problems. |
|
|
Displays Help. |
|
|
If Example: |
The command returns a table that contains the following information:
Output type identifier ("ASSOCIATION")
The route table association ID (needed to disassociate the route table)
The route table ID
Amazon EC2 command line tools display errors on stderr.
This example associates the route-table (with ID rtb-6aa34603) with the subnet with ID subnet-92a045fb.
PROMPT>ec2-associate-route-table rtb-6aa34603 -s subnet-92a045fbASSOCIATION rtbassoc-61a34608 rtb-6aa34603 subnet-92a045fb