Skip to content

/AWS1/CL_EC2=>CREATEROUTE()

About CreateRoute

Creates a route in a route table within a VPC.

You must specify either a destination CIDR block or a prefix list ID. You must also specify exactly one of the resources from the parameter list.

When determining how to route traffic, we use the route with the most specific match. For example, traffic is destined for the IPv4 address 192.0.2.3, and the route table includes the following two IPv4 routes:

  • 192.0.2.0/24 (goes to some target A)

  • 192.0.2.0/28 (goes to some target B)

Both routes apply to the traffic destined for 192.0.2.3. However, the second route in the list covers a smaller number of IP addresses and is therefore more specific, so we use that route to determine where to target the traffic.

For more information about route tables, see Route tables in the Amazon VPC User Guide.

Method Signature

IMPORTING

Required arguments:

IV_ROUTETABLEID TYPE /AWS1/EC2ROUTETABLEID /AWS1/EC2ROUTETABLEID

The ID of the route table for the route.

Optional arguments:

IV_DESTINATIONCIDRBLOCK TYPE /AWS1/EC2STRING /AWS1/EC2STRING

The IPv4 CIDR address block used for the destination match. Routing decisions are based on the most specific match. We modify the specified CIDR block to its canonical form; for example, if you specify 100.68.0.18/18, we modify it to 100.68.0.0/18.

IV_DESTINATIONIPV6CIDRBLOCK TYPE /AWS1/EC2STRING /AWS1/EC2STRING

The IPv6 CIDR block used for the destination match. Routing decisions are based on the most specific match.

IV_DESTINATIONPREFIXLISTID TYPE /AWS1/EC2PREFIXLISTRESOURCEID /AWS1/EC2PREFIXLISTRESOURCEID

The ID of a prefix list used for the destination match.

IV_DRYRUN TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

IV_VPCENDPOINTID TYPE /AWS1/EC2VPCENDPOINTID /AWS1/EC2VPCENDPOINTID

The ID of a VPC endpoint. Supported for Gateway Load Balancer endpoints only.

IV_EGRESSONLYINTERNETGWID TYPE /AWS1/EC2EGRONLYINTERNETGWID /AWS1/EC2EGRONLYINTERNETGWID

[IPv6 traffic only] The ID of an egress-only internet gateway.

IV_GATEWAYID TYPE /AWS1/EC2ROUTEGATEWAYID /AWS1/EC2ROUTEGATEWAYID

The ID of an internet gateway or virtual private gateway attached to your VPC.

IV_INSTANCEID TYPE /AWS1/EC2INSTANCEID /AWS1/EC2INSTANCEID

The ID of a NAT instance in your VPC. The operation fails if you specify an instance ID unless exactly one network interface is attached.

IV_NATGATEWAYID TYPE /AWS1/EC2NATGATEWAYID /AWS1/EC2NATGATEWAYID

[IPv4 traffic only] The ID of a NAT gateway.

IV_TRANSITGATEWAYID TYPE /AWS1/EC2TRANSITGATEWAYID /AWS1/EC2TRANSITGATEWAYID

The ID of a transit gateway.

IV_LOCALGATEWAYID TYPE /AWS1/EC2LOCALGATEWAYID /AWS1/EC2LOCALGATEWAYID

The ID of the local gateway.

IV_CARRIERGATEWAYID TYPE /AWS1/EC2CARRIERGATEWAYID /AWS1/EC2CARRIERGATEWAYID

The ID of the carrier gateway.

You can only use this option when the VPC contains a subnet which is associated with a Wavelength Zone.

IV_NETWORKINTERFACEID TYPE /AWS1/EC2NETWORKINTERFACEID /AWS1/EC2NETWORKINTERFACEID

The ID of a network interface.

IV_VPCPEERINGCONNECTIONID TYPE /AWS1/EC2VPCPEERINGCONNID /AWS1/EC2VPCPEERINGCONNID

The ID of a VPC peering connection.

IV_CORENETWORKARN TYPE /AWS1/EC2CORENETWORKARN /AWS1/EC2CORENETWORKARN

The Amazon Resource Name (ARN) of the core network.

RETURNING

OO_OUTPUT TYPE REF TO /AWS1/CL_EC2CREATEROUTERESULT /AWS1/CL_EC2CREATEROUTERESULT