Setting the Main Route Table

You can set the route table you want to use as the main one for the Net. This route table is then automatically applied to Subnets that are not explicitly associated with a route table.

Setting the Main Route Table Using AWS CLI

To set a route table as main, use the replace-route-table-association command following this syntax:

Request sample
$ aws ec2 replace-route-table-association \
    --profile YOUR_PROFILE \
    --association-id rtbassoc-4321dcba \
    --route-table-id rtb-1234abcd \

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • association-id: The association ID of the current main route table. For more information, see Getting Information About Your Route Tables.

  • route-table-id: The ID of the route table you want to set as main.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The replace-route-table-association command returns the following element:

  • NewAssociationId: The new association ID.

Result sample
    "NewAssociationId": "rtbassoc-abcd1234"

The route table is set as the main one for the VPC.

Related Pages

Corresponding API Method

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.