Skip to content

/AWS1/IF_EL2=>REGISTERTARGETS()

About RegisterTargets

Registers the specified targets with the specified target group.

If the target is an EC2 instance, it must be in the running state when you register it.

By default, the load balancer routes requests to registered targets using the protocol and port for the target group. Alternatively, you can override the port for a target when you register it. You can register each EC2 instance or IP address with the same target group multiple times using different ports.

For more information, see the following:

Method Signature

METHODS /AWS1/IF_EL2~REGISTERTARGETS
  IMPORTING
    !IV_TARGETGROUPARN TYPE /AWS1/EL2TARGETGROUPARN OPTIONAL
    !IT_TARGETS TYPE /AWS1/CL_EL2TARGETDESCRIPTION=>TT_TARGETDESCRIPTIONS OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_el2regtargetsoutput
  RAISING
    /AWS1/CX_EL2INVALIDTARGETEX
    /AWS1/CX_EL2TGTGROUPNOTFOUNDEX
    /AWS1/CX_EL2TOOMANYREGSFORTG00
    /AWS1/CX_EL2TOOMANYTARGETSEX
    /AWS1/CX_EL2CLIENTEXC
    /AWS1/CX_EL2SERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_targetgrouparn TYPE /AWS1/EL2TARGETGROUPARN /AWS1/EL2TARGETGROUPARN

The Amazon Resource Name (ARN) of the target group.

it_targets TYPE /AWS1/CL_EL2TARGETDESCRIPTION=>TT_TARGETDESCRIPTIONS TT_TARGETDESCRIPTIONS

The targets.

RETURNING

oo_output TYPE REF TO /aws1/cl_el2regtargetsoutput /AWS1/CL_EL2REGTARGETSOUTPUT

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->registertargets(
  it_targets = VALUE /aws1/cl_el2targetdescription=>tt_targetdescriptions(
    (
      new /aws1/cl_el2targetdescription(
        iv_availabilityzone = |string|
        iv_id = |string|
        iv_port = 123
        iv_quicserverid = |string|
      )
    )
  )
  iv_targetgrouparn = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
ENDIF.

To register targets with a target group

This example registers the specified instances with the specified target group.

DATA(lo_result) = lo_client->registertargets(
  it_targets = VALUE /aws1/cl_el2targetdescription=>tt_targetdescriptions(
    ( new /aws1/cl_el2targetdescription( iv_id = |i-80c8dd94| )  )
    ( new /aws1/cl_el2targetdescription( iv_id = |i-ceddcd4d| )  )
  )
  iv_targetgrouparn = |arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067|
).

To register targets with a target group using port overrides

This example registers the specified instance with the specified target group using multiple ports. This enables you to register ECS containers on the same instance as targets in the target group.

DATA(lo_result) = lo_client->registertargets(
  it_targets = VALUE /aws1/cl_el2targetdescription=>tt_targetdescriptions(
    (
      new /aws1/cl_el2targetdescription(
        iv_id = |i-80c8dd94|
        iv_port = 80
      )
    )
    (
      new /aws1/cl_el2targetdescription(
        iv_id = |i-80c8dd94|
        iv_port = 766
      )
    )
  )
  iv_targetgrouparn = |arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/3bb63f11dfb0faf9|
).