Associating a Route Table with a Subnet

You can associate a route table to one or more of the subnets of the Virtual Private Cloud (VPC) for which it is created. The routes contained in the route table are automatically applied to instances placed in the subnet to route network traffic.

Associating a Route Table with a Subnet Using Cockpit v1

  1. Click Network/Security > Route Tables.

    You can also associate a route table with a selected subnet from the VPC > VPCs page, using the Associate Route Table command of the subnets panel. For more information, see VPC User Interface.

  2. Click the route table you want to associate with a subnet.
    The route table is selected.

  3. Click Attach .
    The ATTACH ROUTE TABLE dialog box appears.

  4. From the Subnet list, select the subnet you want to associate the route table.

  5. Click Attach to validate.
    The route table is associated with the selected subnet.

Linking a Route Table to a Subnet Using Cockpit v2-beta

  1. In the Nets dashboard, click the ID of the Net where the Subnet to which you want to associate a route table is.
    The Subnet panel appears.

  2. Click inside the Subnet panel to make checkboxes appear.

  3. Check the box of the Subnet to which you want to associate a route table.
    The Subnet is selected and an action menu is displayed.

  4. Click IconLink Link Route Table.
    The LINK ROUTE TABLE dialog box appears.

  5. In the list, select the route table you want to link to the Subnet.

  6. Click Link Route Table to validate.
    The route table is linked to the Subnet.

Associating a Route Table with a Subnet Using AWS CLI

To associate a route table with a subnet, use the associate-route-table command following this syntax:

Request sample
$ aws ec2 associate-route-table \
    --profile YOUR_PROFILE \
    --subnet-id subnet-87654321 \
    --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.

  • subnet-id: The ID of the subnet.

  • route-table-id: The ID of the route table.

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

The associate-route-table command returns the following element:

  • AssociationId: The ID of the association between the subnet and the route table.

Result sample
{
    "AssociationId": "rtbassoc-781d0d1a"
}

The route table is associated with the specified subnet.

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.