Linking a Route Table with a Subnet
You can link a route table to one or more of the Subnets of the Net for which it is created. The routes contained in the route table are automatically applied to virtual machines (VMs) placed in the Subnet to route network traffic.
Linking a Route Table to a Subnet Using Cockpit v2
You can also do this action in the Nets dashboard, by clicking the ID of a Net, selecting a Subnet, and clicking Link Route Table in the action menu. |
-
In the Route Tables dashboard, check the box of the route table you want to link to a Subnet.
-
Click Link to Subnet.
The LINK TO SUBNET dialog box appears. -
From the list, select the Subnet you want to link to the route table.
-
Click Link.
The route table is linked to the Subnet.
Linking a Route Table to a Subnet Using OSC CLI
The LinkRouteTable command associates a Subnet with a route table.
The Subnet and the route table must be in the same Net. The traffic is routed according to the route table defined within this Net. You can associate a route table with several Subnets.
$ osc-cli api LinkRouteTable --profile "default" \
--RouteTableId "rtb-12345678" \
--SubnetId "subnet-12345678"
This command contains the following attributes that you need to specify:
-
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
RouteTableId
: The ID of the route table. -
SubnetId
: The ID of the Subnet.
The LinkRouteTable command returns the following elements:
-
LinkRouteTableId
: The ID of the association between the route table and the Subnet. -
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
},
"LinkRouteTableId": "rtbassoc-12345678"
}
Linking a Route Table to a Subnet Using oapi-cli
The LinkRouteTable command associates a Subnet with a route table.
The Subnet and the route table must be in the same Net. The traffic is routed according to the route table defined within this Net. You can associate a route table with several Subnets.
$ oapi-cli --profile "default" LinkRouteTable \
--RouteTableId "rtb-12345678" \
--SubnetId "subnet-12345678"
This command contains the following attributes that you need to specify:
-
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
RouteTableId
: The ID of the route table. -
SubnetId
: The ID of the Subnet.
The LinkRouteTable command returns the following elements:
-
LinkRouteTableId
: The ID of the association between the route table and the Subnet. -
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
},
"LinkRouteTableId": "rtbassoc-12345678"
}
Associating a Route Table with a Subnet Using AWS CLI
Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring AWS CLI. |
To associate a route table with a subnet, use the associate-route-table command following this syntax:
$ 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. For more information, see Installing and Configuring AWS CLI.
The associate-route-table command returns the following element:
-
AssociationId
: The ID of the association between the subnet and the route table.
{
"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.