Skip to content

/AWS1/CL_EC2=>MODIFYFLEET()

About ModifyFleet

Modifies the specified EC2 Fleet.

You can only modify an EC2 Fleet request of type maintain.

While the EC2 Fleet is being modified, it is in the modifying state.

To scale up your EC2 Fleet, increase its target capacity. The EC2 Fleet launches the additional Spot Instances according to the allocation strategy for the EC2 Fleet request. If the allocation strategy is lowest-price, the EC2 Fleet launches instances using the Spot Instance pool with the lowest price. If the allocation strategy is diversified, the EC2 Fleet distributes the instances across the Spot Instance pools. If the allocation strategy is capacity-optimized, EC2 Fleet launches instances from Spot Instance pools with optimal capacity for the number of instances that are launching.

To scale down your EC2 Fleet, decrease its target capacity. First, the EC2 Fleet cancels any open requests that exceed the new target capacity. You can request that the EC2 Fleet terminate Spot Instances until the size of the fleet no longer exceeds the new target capacity. If the allocation strategy is lowest-price, the EC2 Fleet terminates the instances with the highest price per unit. If the allocation strategy is capacity-optimized, the EC2 Fleet terminates the instances in the Spot Instance pools that have the least available Spot Instance capacity. If the allocation strategy is diversified, the EC2 Fleet terminates instances across the Spot Instance pools. Alternatively, you can request that the EC2 Fleet keep the fleet at its current size, but not replace any Spot Instances that are interrupted or that you terminate manually.

If you are finished with your EC2 Fleet for now, but will use it again later, you can set the target capacity to 0.

Method Signature

IMPORTING

Required arguments:

iv_fleetid TYPE /AWS1/EC2FLEETID /AWS1/EC2FLEETID

The ID of the EC2 Fleet.

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.

iv_excesscapterminationply TYPE /AWS1/EC2FLEETEXCESSCAPTERMI00 /AWS1/EC2FLEETEXCESSCAPTERMI00

Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2 Fleet.

Supported only for fleets of type maintain.

it_launchtemplateconfigs TYPE /AWS1/CL_EC2FLEETLAUNCHTMPLC00=>TT_FLEETLAUNCHTMPLCFGLISTREQ TT_FLEETLAUNCHTMPLCFGLISTREQ

The launch template and overrides.

io_targetcapacityspec TYPE REF TO /AWS1/CL_EC2TARGETCAPSPECREQ /AWS1/CL_EC2TARGETCAPSPECREQ

The size of the EC2 Fleet.

iv_context TYPE /AWS1/EC2STRING /AWS1/EC2STRING

Reserved.

RETURNING

oo_output TYPE REF TO /aws1/cl_ec2modifyfleetresult /AWS1/CL_EC2MODIFYFLEETRESULT

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~modifyfleet(
  io_targetcapacityspec = new /aws1/cl_ec2targetcapspecreq(
    iv_defaulttargetcapacitytype = |string|
    iv_ondemandtargetcapacity = 123
    iv_spottargetcapacity = 123
    iv_targetcapacityunittype = |string|
    iv_totaltargetcapacity = 123
  )
  it_launchtemplateconfigs = VALUE /aws1/cl_ec2fleetlaunchtmplc00=>tt_fleetlaunchtmplcfglistreq(
    (
      new /aws1/cl_ec2fleetlaunchtmplc00(
        io_launchtemplatespec = new /aws1/cl_ec2fleetlaunchtmpls00(
          iv_launchtemplateid = |string|
          iv_launchtemplatename = |string|
          iv_version = |string|
        )
        it_overrides = VALUE /aws1/cl_ec2fleetlaunchtmplo00=>tt_fleetlaunchtmploverridesl00(
          (
            new /aws1/cl_ec2fleetlaunchtmplo00(
              io_instancerequirements = new /aws1/cl_ec2instrequirements00(
                io_acceleratorcount = new /aws1/cl_ec2acceleratorcntreq(
                  iv_max = 123
                  iv_min = 123
                )
                io_acceleratortotalmemorymib = new /aws1/cl_ec2acceleratortotal00(
                  iv_max = 123
                  iv_min = 123
                )
                io_baselineebsbandwidthmbps = new /aws1/cl_ec2baselineebsbandw00(
                  iv_max = 123
                  iv_min = 123
                )
                io_baselineperformancefact00 = new /aws1/cl_ec2baselineperforma00(
                  io_cpu = new /aws1/cl_ec2cpuperformancefa00(
                    it_references = VALUE /aws1/cl_ec2performancefacto00=>tt_performancefactorreferenc00(
                      ( new /aws1/cl_ec2performancefacto00( |string| ) )
                    )
                  )
                )
                io_memorygibpervcpu = new /aws1/cl_ec2memorygibpervcpu00(
                  iv_max = '0.1'
                  iv_min = '0.1'
                )
                io_memorymib = new /aws1/cl_ec2memorymibrequest(
                  iv_max = 123
                  iv_min = 123
                )
                io_networkbandwidthgbps = new /aws1/cl_ec2networkbandwidth00(
                  iv_max = '0.1'
                  iv_min = '0.1'
                )
                io_networkinterfacecount = new /aws1/cl_ec2networkinterface00(
                  iv_max = 123
                  iv_min = 123
                )
                io_totallocalstoragegb = new /aws1/cl_ec2totallocalstrggb00(
                  iv_max = '0.1'
                  iv_min = '0.1'
                )
                io_vcpucount = new /aws1/cl_ec2vcpucountrangereq(
                  iv_max = 123
                  iv_min = 123
                )
                it_acceleratormanufacturers = VALUE /aws1/cl_ec2acceleratormanuf00=>tt_acceleratormanufacturerset(
                  ( new /aws1/cl_ec2acceleratormanuf00( |string| ) )
                )
                it_acceleratornames = VALUE /aws1/cl_ec2acceleratornames00=>tt_acceleratornameset(
                  ( new /aws1/cl_ec2acceleratornames00( |string| ) )
                )
                it_acceleratortypes = VALUE /aws1/cl_ec2acceleratortypes00=>tt_acceleratortypeset(
                  ( new /aws1/cl_ec2acceleratortypes00( |string| ) )
                )
                it_allowedinstancetypes = VALUE /aws1/cl_ec2alwedinsttypeset_w=>tt_allowedinstancetypeset(
                  ( new /aws1/cl_ec2alwedinsttypeset_w( |string| ) )
                )
                it_cpumanufacturers = VALUE /aws1/cl_ec2cpumanufacturers00=>tt_cpumanufacturerset(
                  ( new /aws1/cl_ec2cpumanufacturers00( |string| ) )
                )
                it_excludedinstancetypes = VALUE /aws1/cl_ec2excludedinsttype00=>tt_excludedinstancetypeset(
                  ( new /aws1/cl_ec2excludedinsttype00( |string| ) )
                )
                it_instancegenerations = VALUE /aws1/cl_ec2instgenerationse00=>tt_instancegenerationset(
                  ( new /aws1/cl_ec2instgenerationse00( |string| ) )
                )
                it_localstoragetypes = VALUE /aws1/cl_ec2localstrgtypeset_w=>tt_localstoragetypeset(
                  ( new /aws1/cl_ec2localstrgtypeset_w( |string| ) )
                )
                iv_baremetal = |string|
                iv_burstableperformance = |string|
                iv_localstorage = |string|
                iv_maxspotpriceaspercentag00 = 123
                iv_ondemmaxpricepercentage00 = 123
                iv_requirehibernatesupport = ABAP_TRUE
                iv_spotmaxpricepercentageo00 = 123
              )
              io_placement = new /aws1/cl_ec2placement(
                iv_affinity = |string|
                iv_availabilityzone = |string|
                iv_groupid = |string|
                iv_groupname = |string|
                iv_hostid = |string|
                iv_hostresourcegrouparn = |string|
                iv_partitionnumber = 123
                iv_spreaddomain = |string|
                iv_tenancy = |string|
              )
              it_blockdevicemappings = VALUE /aws1/cl_ec2fleetblkdevmapreq=>tt_fleetblockdevicemapreqlist(
                (
                  new /aws1/cl_ec2fleetblkdevmapreq(
                    io_ebs = new /aws1/cl_ec2fleetebsblkdevreq(
                      iv_deleteontermination = ABAP_TRUE
                      iv_encrypted = ABAP_TRUE
                      iv_iops = 123
                      iv_kmskeyid = |string|
                      iv_snapshotid = |string|
                      iv_throughput = 123
                      iv_volumesize = 123
                      iv_volumetype = |string|
                    )
                    iv_devicename = |string|
                    iv_nodevice = |string|
                    iv_virtualname = |string|
                  )
                )
              )
              iv_availabilityzone = |string|
              iv_imageid = |string|
              iv_instancetype = |string|
              iv_maxprice = |string|
              iv_priority = '0.1'
              iv_subnetid = |string|
              iv_weightedcapacity = '0.1'
            )
          )
        )
      )
    )
  )
  iv_context = |string|
  iv_dryrun = ABAP_TRUE
  iv_excesscapterminationply = |string|
  iv_fleetid = |string|
).

This is an example of reading all possible response values

lv_boolean = lo_result->get_return( ).