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

You can also do this action in the Nets dashboard, by clicking the ID of a Net, selecting a Subnet, and clicking IconLink Link Route Table in the displayed action menu.

  1. Click inside the Route Tables dashboard to make checkboxes appear.

  2. Check the box of the route table you want to link to a Subnet.

  3. Click IconLink Link to Subnet.
    The LINK ROUTE TABLE TO SUBNET dialog box appears.

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

  5. Click Link to Subnet. The route table is linked to the Subnet.

Linking a Route Table to a Subnet Using OSC CLI

See the LinkRouteTable command sample in the documentation of the OUTSCALE API.

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 Methods

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