/AWS1/IF_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¶
METHODS /AWS1/IF_EC2~CREATEROUTE
IMPORTING
!IV_DESTINATIONPREFIXLISTID TYPE /AWS1/EC2PREFIXLISTRESOURCEID OPTIONAL
!IV_VPCENDPOINTID TYPE /AWS1/EC2VPCENDPOINTID OPTIONAL
!IV_TRANSITGATEWAYID TYPE /AWS1/EC2TRANSITGATEWAYID OPTIONAL
!IV_LOCALGATEWAYID TYPE /AWS1/EC2LOCALGATEWAYID OPTIONAL
!IV_CARRIERGATEWAYID TYPE /AWS1/EC2CARRIERGATEWAYID OPTIONAL
!IV_CORENETWORKARN TYPE /AWS1/EC2CORENETWORKARN OPTIONAL
!IV_ODBNETWORKARN TYPE /AWS1/EC2ODBNETWORKARN OPTIONAL
!IV_DRYRUN TYPE /AWS1/EC2BOOLEAN OPTIONAL
!IV_ROUTETABLEID TYPE /AWS1/EC2ROUTETABLEID OPTIONAL
!IV_DESTINATIONCIDRBLOCK TYPE /AWS1/EC2STRING OPTIONAL
!IV_GATEWAYID TYPE /AWS1/EC2ROUTEGATEWAYID OPTIONAL
!IV_DESTINATIONIPV6CIDRBLOCK TYPE /AWS1/EC2STRING OPTIONAL
!IV_EGRESSONLYINTERNETGWID TYPE /AWS1/EC2EGRONLYINTERNETGWID OPTIONAL
!IV_INSTANCEID TYPE /AWS1/EC2INSTANCEID OPTIONAL
!IV_NETWORKINTERFACEID TYPE /AWS1/EC2NETWORKINTERFACEID OPTIONAL
!IV_VPCPEERINGCONNECTIONID TYPE /AWS1/EC2VPCPEERINGCONNID OPTIONAL
!IV_NATGATEWAYID TYPE /AWS1/EC2NATGATEWAYID OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_ec2createrouteresult
RAISING
/AWS1/CX_EC2CLIENTEXC
/AWS1/CX_EC2SERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_routetableid TYPE /AWS1/EC2ROUTETABLEID /AWS1/EC2ROUTETABLEID¶
The ID of the route table for the route.
Optional arguments:¶
iv_destinationprefixlistid TYPE /AWS1/EC2PREFIXLISTRESOURCEID /AWS1/EC2PREFIXLISTRESOURCEID¶
The ID of a prefix list used for the destination match.
iv_vpcendpointid TYPE /AWS1/EC2VPCENDPOINTID /AWS1/EC2VPCENDPOINTID¶
The ID of a VPC endpoint. Supported for Gateway Load Balancer endpoints only.
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_corenetworkarn TYPE /AWS1/EC2CORENETWORKARN /AWS1/EC2CORENETWORKARN¶
The Amazon Resource Name (ARN) of the core network.
iv_odbnetworkarn TYPE /AWS1/EC2ODBNETWORKARN /AWS1/EC2ODBNETWORKARN¶
The Amazon Resource Name (ARN) of the ODB network.
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 isUnauthorizedOperation.
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 to100.68.0.0/18.
iv_gatewayid TYPE /AWS1/EC2ROUTEGATEWAYID /AWS1/EC2ROUTEGATEWAYID¶
The ID of an internet gateway or virtual private gateway attached to your VPC.
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_egressonlyinternetgwid TYPE /AWS1/EC2EGRONLYINTERNETGWID /AWS1/EC2EGRONLYINTERNETGWID¶
[IPv6 traffic only] The ID of an egress-only internet gateway.
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_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_natgatewayid TYPE /AWS1/EC2NATGATEWAYID /AWS1/EC2NATGATEWAYID¶
[IPv4 traffic only] The ID of a NAT gateway.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_ec2createrouteresult /AWS1/CL_EC2CREATEROUTERESULT¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->createroute(
iv_carriergatewayid = |string|
iv_corenetworkarn = |string|
iv_destinationcidrblock = |string|
iv_destinationipv6cidrblock = |string|
iv_destinationprefixlistid = |string|
iv_dryrun = ABAP_TRUE
iv_egressonlyinternetgwid = |string|
iv_gatewayid = |string|
iv_instanceid = |string|
iv_localgatewayid = |string|
iv_natgatewayid = |string|
iv_networkinterfaceid = |string|
iv_odbnetworkarn = |string|
iv_routetableid = |string|
iv_transitgatewayid = |string|
iv_vpcendpointid = |string|
iv_vpcpeeringconnectionid = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_boolean = lo_result->get_return( ).
ENDIF.
To create a route¶
This example creates a route for the specified route table. The route matches all traffic (0.0.0.0/0) and routes it to the specified Internet gateway.
DATA(lo_result) = lo_client->createroute(
iv_destinationcidrblock = |0.0.0.0/0|
iv_gatewayid = |igw-c0a643a9|
iv_routetableid = |rtb-22574640|
).