Changing the Route Table Associated with a Subnet

You can change the route table that is associated with a subnet. This action automatically modifies the way traffic is routed for instances in the subnet, using the routes contained in the new associated route table.

This feature is not available from Cockpit. This documentation only describes the procedure using AWS CLI.

To change the route table associated with a subnet, 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 \
    --endpoint https://fcu.eu-west-2.outscale.com

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 ID of the association between the subnet and the route table to replace.

  • route-table-id: The ID of the new route table to associate with the subnet.

  • 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 ID of the association between the subnet and the new route table.

Result sample
{
    "NewAssociationId": "rtbassoc-abcd1234"
}

The route table associated with the subnet is replaced by the specified one.

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.