Skip to content

/AWS1/IF_EC2=>CREATEINSTANCECONNECTENDPT()

About CreateInstanceConnectEndpoint

Creates an EC2 Instance Connect Endpoint.

An EC2 Instance Connect Endpoint allows you to connect to an instance, without requiring the instance to have a public IPv4 or public IPv6 address. For more information, see Connect to your instances using EC2 Instance Connect Endpoint in the Amazon EC2 User Guide.

Method Signature

IMPORTING

Required arguments:

iv_subnetid TYPE /AWS1/EC2SUBNETID /AWS1/EC2SUBNETID

The ID of the subnet in which to create the EC2 Instance Connect Endpoint.

Optional arguments:

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.

it_securitygroupids TYPE /AWS1/CL_EC2SECGRIDSTRLSTREQ_W=>TT_SECGROUPIDSTRINGLISTREQUEST TT_SECGROUPIDSTRINGLISTREQUEST

One or more security groups to associate with the endpoint. If you don't specify a security group, the default security group for your VPC will be associated with the endpoint.

iv_preserveclientip TYPE /AWS1/EC2BOOLEAN /AWS1/EC2BOOLEAN

Indicates whether the client IP address is preserved as the source. The following are the possible values.

  • true - Use the client IP address as the source.

  • false - Use the network interface IP address as the source.

PreserveClientIp is only supported on IPv4 EC2 Instance Connect Endpoints. To use PreserveClientIp, the value for IpAddressType must be ipv4.

Default: false

iv_clienttoken TYPE /AWS1/EC2STRING /AWS1/EC2STRING

Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

it_tagspecifications TYPE /AWS1/CL_EC2TAGSPECIFICATION=>TT_TAGSPECIFICATIONLIST TT_TAGSPECIFICATIONLIST

The tags to apply to the EC2 Instance Connect Endpoint during creation.

iv_ipaddresstype TYPE /AWS1/EC2IPADDRESSTYPE /AWS1/EC2IPADDRESSTYPE

The IP address type of the endpoint.

If no value is specified, the default value is determined by the IP address type of the subnet:

  • dualstack - If the subnet has both IPv4 and IPv6 CIDRs

  • ipv4 - If the subnet has only IPv4 CIDRs

  • ipv6 - If the subnet has only IPv6 CIDRs

PreserveClientIp is only supported on IPv4 EC2 Instance Connect Endpoints. To use PreserveClientIp, the value for IpAddressType must be ipv4.

RETURNING

oo_output TYPE REF TO /aws1/cl_ec2creinstcnctendptrs /AWS1/CL_EC2CREINSTCNCTENDPTRS

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->/aws1/if_ec2~createinstanceconnectendpt(
  it_securitygroupids = VALUE /aws1/cl_ec2secgridstrlstreq_w=>tt_secgroupidstringlistrequest(
    ( new /aws1/cl_ec2secgridstrlstreq_w( |string| ) )
  )
  it_tagspecifications = VALUE /aws1/cl_ec2tagspecification=>tt_tagspecificationlist(
    (
      new /aws1/cl_ec2tagspecification(
        it_tags = VALUE /aws1/cl_ec2tag=>tt_taglist(
          (
            new /aws1/cl_ec2tag(
              iv_key = |string|
              iv_value = |string|
            )
          )
        )
        iv_resourcetype = |string|
      )
    )
  )
  iv_clienttoken = |string|
  iv_dryrun = ABAP_TRUE
  iv_ipaddresstype = |string|
  iv_preserveclientip = ABAP_TRUE
  iv_subnetid = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_ec2instanceconnectendpo = lo_result->get_instanceconnectendpoint( ).
  IF lo_ec2instanceconnectendpo IS NOT INITIAL.
    lv_string = lo_ec2instanceconnectendpo->get_ownerid( ).
    lv_instanceconnectendpoint = lo_ec2instanceconnectendpo->get_instanceconnectendptid( ).
    lv_resourcearn = lo_ec2instanceconnectendpo->get_instanceconnectendptarn( ).
    lv_ec2instanceconnectendpo_1 = lo_ec2instanceconnectendpo->get_state( ).
    lv_string = lo_ec2instanceconnectendpo->get_statemessage( ).
    lv_string = lo_ec2instanceconnectendpo->get_dnsname( ).
    lv_string = lo_ec2instanceconnectendpo->get_fipsdnsname( ).
    LOOP AT lo_ec2instanceconnectendpo->get_networkinterfaceids( ) into lo_row.
      lo_row_1 = lo_row.
      IF lo_row_1 IS NOT INITIAL.
        lv_string = lo_row_1->get_value( ).
      ENDIF.
    ENDLOOP.
    lv_vpcid = lo_ec2instanceconnectendpo->get_vpcid( ).
    lv_string = lo_ec2instanceconnectendpo->get_availabilityzone( ).
    lv_milliseconddatetime = lo_ec2instanceconnectendpo->get_createdat( ).
    lv_subnetid = lo_ec2instanceconnectendpo->get_subnetid( ).
    lv_boolean = lo_ec2instanceconnectendpo->get_preserveclientip( ).
    LOOP AT lo_ec2instanceconnectendpo->get_securitygroupids( ) into lo_row_2.
      lo_row_3 = lo_row_2.
      IF lo_row_3 IS NOT INITIAL.
        lv_securitygroupid = lo_row_3->get_value( ).
      ENDIF.
    ENDLOOP.
    LOOP AT lo_ec2instanceconnectendpo->get_tags( ) into lo_row_4.
      lo_row_5 = lo_row_4.
      IF lo_row_5 IS NOT INITIAL.
        lv_string = lo_row_5->get_key( ).
        lv_string = lo_row_5->get_value( ).
      ENDIF.
    ENDLOOP.
    lv_ipaddresstype = lo_ec2instanceconnectendpo->get_ipaddresstype( ).
    lo_instanceconnectendpoint_1 = lo_ec2instanceconnectendpo->get_publicdnsnames( ).
    IF lo_instanceconnectendpoint_1 IS NOT INITIAL.
      lo_instanceconnectendpoint_2 = lo_instanceconnectendpoint_1->get_ipv4( ).
      IF lo_instanceconnectendpoint_2 IS NOT INITIAL.
        lv_string = lo_instanceconnectendpoint_2->get_dnsname( ).
        lv_string = lo_instanceconnectendpoint_2->get_fipsdnsname( ).
      ENDIF.
      lo_instanceconnectendpoint_2 = lo_instanceconnectendpoint_1->get_dualstack( ).
      IF lo_instanceconnectendpoint_2 IS NOT INITIAL.
        lv_string = lo_instanceconnectendpoint_2->get_dnsname( ).
        lv_string = lo_instanceconnectendpoint_2->get_fipsdnsname( ).
      ENDIF.
    ENDIF.
  ENDIF.
  lv_string = lo_result->get_clienttoken( ).
ENDIF.