Creating a Route
You can create a route in a route table to specify how traffic is routed for instances in its associated subnets.
You can create routes using the following targets:
-
An Internet gateway, to enable instances with an associated External IP to directly connect to the Internet
-
A virtual private gateway, to route traffic to a DirectLink or a VPN connection
-
A Network Address Translation (NAT) gateway, to enable instances to indirectly connect to the Internet
-
An instance
-
A network interface of an instance
-
A VPC peering connection, to enable instances to forward traffic to a peered VPC
When you create a VPC endpoint, the appropriate route is automatically created and added to the route tables you specify. For more information, see About Route Tables and About VPC Endpoints. |
Creating a Route Using Cockpit v1
Before you begin: Create a route table. For more information, see Creating a Route Table. |
-
Click Network/Security > Route Tables.
-
Click the route table in which you want to create a route.
The list of routes in the selected route table appears. -
Click Create Route .
The CREATE A ROUTE dialog box appears. -
In the Target list, select the ID of the resource to use as target.
For more information, see About Route Tables > Routes and Routing Options. -
In the Destination field, type the destination range of IPs, in CIDR notation.
To specify the 0.0.0.0/0 CIDR, click All IPs.
-
Click Create to validate.
The route is created and appears in the list of routes of the route table.
Creating a Route Using OSC CLI
Before you begin: Create a route table. For more information, see Creating a Route Table. |
See the CreateRoute command sample in the documentation of the OUTSCALE API. |
Creating a Route Using AWS CLI
Before you begin: Create a route table. For more information, see Creating a Route Table. |
To create a route in a route table, use the create-route command following this syntax:
$ aws ec2 create-route \
--profile YOUR_PROFILE \
--route-table-id rtb-87654321 \
--destination-cidr-block 0.0.0.0/0 \
--gateway-id igw-1234abcd \
[--instance-id NOT_SPECIFIED] \
[--network-interface-id NOT_SPECIFIED] \
[--vpc-peering-connection-id NOT_SPECIFIED] \
[--nat-gateway-id NOT_SPECIFIED] \
--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. -
route-table-id
: The ID of the route table in which you want to create a route. -
destination-cidr-block
: The destination range of IPs, in CIDR notation. -
(optional)
gateway-id
: The ID of the Internet gateway or virtual private gateway attached to the VPC to use as the route target. -
(optional)
instance-id
: The ID of an instance in the VPC to use as the route target.The instance must only have one network interface attached (the primary one, and no flexible network interfaces). If the instance has several network interfaces attached, use the
network-interface-id
attribute to specify the one you want to use as the route target. -
(optional)
network-interface-id
: The ID of a network interface to use as the route target (the primary network interface or a flexible network interface). -
(optional)
vpc-peering-connection-id
: The ID of a VPC peering connection to use as the route target. -
(optional)
nat-gateway-id
: The ID of a NAT gateway to use as the route target. -
endpoint
: The endpoint corresponding to the Region you want to send the request to.
The create-route command returns true
if the request succeeded and the route is created. Otherwise, it returns an error.
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.