Skip to content

/AWS1/IF_ASC=>LAUNCHINSTANCES()

About LaunchInstances

Launches a specified number of instances in an Auto Scaling group. Returns instance IDs and other details if launch is successful or error details if launch is unsuccessful.

Method Signature

METHODS /AWS1/IF_ASC~LAUNCHINSTANCES
  IMPORTING
    !IV_AUTOSCALINGGROUPNAME TYPE /AWS1/ASCXMLSTRINGMAXLEN255 OPTIONAL
    !IV_REQUESTEDCAPACITY TYPE /AWS1/ASCREQUESTEDCAPACITY OPTIONAL
    !IV_CLIENTTOKEN TYPE /AWS1/ASCCLIENTTOKEN OPTIONAL
    !IT_AVAILABILITYZONES TYPE /AWS1/CL_ASCAZSLIMIT1_W=>TT_AVAILABILITYZONESLIMIT1 OPTIONAL
    !IT_AVAILABILITYZONEIDS TYPE /AWS1/CL_ASCAZIDSLIMIT1_W=>TT_AVAILABILITYZONEIDSLIMIT1 OPTIONAL
    !IT_SUBNETIDS TYPE /AWS1/CL_ASCSUBNETIDSLIMIT1_W=>TT_SUBNETIDSLIMIT1 OPTIONAL
    !IV_RETRYSTRATEGY TYPE /AWS1/ASCRETRYSTRATEGY OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_asclaunchinstsresult
  RAISING
    /AWS1/CX_ASCIDEMPARAMMMERROR
    /AWS1/CX_ASCRESRCCONTIONFAULT
    /AWS1/CX_ASCCLIENTEXC
    /AWS1/CX_ASCSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_autoscalinggroupname TYPE /AWS1/ASCXMLSTRINGMAXLEN255 /AWS1/ASCXMLSTRINGMAXLEN255

The name of the Auto Scaling group to launch instances into.

iv_requestedcapacity TYPE /AWS1/ASCREQUESTEDCAPACITY /AWS1/ASCREQUESTEDCAPACITY

The number of instances to launch. Although this value can exceed 100 for instance weights, the actual instance count is limited to 100 instances per launch.

iv_clienttoken TYPE /AWS1/ASCCLIENTTOKEN /AWS1/ASCCLIENTTOKEN

A unique, case-sensitive identifier to ensure idempotency of the request.

Optional arguments:

it_availabilityzones TYPE /AWS1/CL_ASCAZSLIMIT1_W=>TT_AVAILABILITYZONESLIMIT1 TT_AVAILABILITYZONESLIMIT1

The Availability Zones for the instance launch. Must match or be included in the Auto Scaling group's Availability Zone configuration. Either AvailabilityZones or SubnetIds must be specified for groups with multiple Availability Zone configurations.

it_availabilityzoneids TYPE /AWS1/CL_ASCAZIDSLIMIT1_W=>TT_AVAILABILITYZONEIDSLIMIT1 TT_AVAILABILITYZONEIDSLIMIT1

A list of Availability Zone IDs where instances should be launched. Must match or be included in the group's AZ configuration. You cannot specify both AvailabilityZones and AvailabilityZoneIds. Required for multi-AZ groups, optional for single-AZ groups.

it_subnetids TYPE /AWS1/CL_ASCSUBNETIDSLIMIT1_W=>TT_SUBNETIDSLIMIT1 TT_SUBNETIDSLIMIT1

The subnet IDs for the instance launch. Either AvailabilityZones or SubnetIds must be specified. If both are specified, the subnets must reside in the specified Availability Zones.

iv_retrystrategy TYPE /AWS1/ASCRETRYSTRATEGY /AWS1/ASCRETRYSTRATEGY

Specifies whether to retry asynchronously if the synchronous launch fails. Valid values are NONE (default, no async retry) and RETRY_WITH_GROUP_CONFIGURATION (increase desired capacity and retry with group configuration).

RETURNING

oo_output TYPE REF TO /aws1/cl_asclaunchinstsresult /AWS1/CL_ASCLAUNCHINSTSRESULT

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->launchinstances(
  it_availabilityzoneids = VALUE /aws1/cl_ascazidslimit1_w=>tt_availabilityzoneidslimit1(
    ( new /aws1/cl_ascazidslimit1_w( |string| ) )
  )
  it_availabilityzones = VALUE /aws1/cl_ascazslimit1_w=>tt_availabilityzoneslimit1(
    ( new /aws1/cl_ascazslimit1_w( |string| ) )
  )
  it_subnetids = VALUE /aws1/cl_ascsubnetidslimit1_w=>tt_subnetidslimit1(
    ( new /aws1/cl_ascsubnetidslimit1_w( |string| ) )
  )
  iv_autoscalinggroupname = |string|
  iv_clienttoken = |string|
  iv_requestedcapacity = 123
  iv_retrystrategy = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_xmlstringmaxlen255 = lo_result->get_autoscalinggroupname( ).
  lv_clienttoken = lo_result->get_clienttoken( ).
  LOOP AT lo_result->get_instances( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_xmlstringmaxlen255 = lo_row_1->get_instancetype( ).
      lv_xmlstringmaxlen64 = lo_row_1->get_markettype( ).
      lv_xmlstringmaxlen255 = lo_row_1->get_subnetid( ).
      lv_xmlstringmaxlen255 = lo_row_1->get_availabilityzone( ).
      lv_xmlstringmaxlen255 = lo_row_1->get_availabilityzoneid( ).
      LOOP AT lo_row_1->get_instanceids( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_xmlstringmaxlen19 = lo_row_3->get_value( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
  LOOP AT lo_result->get_errors( ) into lo_row_4.
    lo_row_5 = lo_row_4.
    IF lo_row_5 IS NOT INITIAL.
      lv_xmlstringmaxlen255 = lo_row_5->get_instancetype( ).
      lv_xmlstringmaxlen64 = lo_row_5->get_markettype( ).
      lv_xmlstringmaxlen255 = lo_row_5->get_subnetid( ).
      lv_xmlstringmaxlen255 = lo_row_5->get_availabilityzone( ).
      lv_xmlstringmaxlen255 = lo_row_5->get_availabilityzoneid( ).
      lv_xmlstringmaxlen64 = lo_row_5->get_errorcode( ).
      lv_xmlstring = lo_row_5->get_errormessage( ).
    ENDIF.
  ENDLOOP.
ENDIF.