CreateRoute
In this article:
CreateRoute#
Description#
Creates a route in a route table within a VPC.
Request Parameters#
Required parameters#
DestinationCidrBlock — The CIDR address block used for the destination match.
Type: String
Required: Yes
RouteTableId — The ID of the route table.
Type: String
Required: Yes
Optional parameters#
GatewayId – The gateway (VPN or Internet gateway) ID.
Type: String
Required: No
instanceId — The ID of the instance.
Type: String
Required: No
NetworkInterfaceId — The ID of the network interface.
Type: String
Required: No
TransitGatewayId — The ID of the transit gateway.
Type: String
Required: No
Response Elements#
requestId — The request ID.
Type: String
return —
True
is returned if the request succeeds and an error otherwise.Type: Boolean
Examples#
c2-ec2 CreateRoute RouteTableId rtb-12345678 DestinationCidrBlock 10.10.10.0/24 GatewayId vpn-12345678
c2-ec2 CreateRoute RouteTableId rtb-12345678 DestinationCidrBlock 10.10.10.0/24 NetworkInterfaceId eni-12345678
c2-ec2 CreateRoute RouteTableId rtb-12345678 DestinationCidrBlock 10.10.10.0/24 InstanceId i-12345678
c2-ec2 CreateRoute RouteTableId rtb-12345678 DestinationCidrBlock 10.10.10.0/24 TransitGatewayId tgw-12345678