Skip to content

/AWS1/CL_EC2=>MODIFYSPOTFLEETREQUEST()

About ModifySpotFleetRequest

Modifies the specified Spot Fleet request.

You can only modify a Spot Fleet request of type maintain.

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

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

To scale down your Spot Fleet, decrease its target capacity. First, the Spot Fleet cancels any open requests that exceed the new target capacity. You can request that the Spot Fleet terminate Spot Instances until the size of the fleet no longer exceeds the new target capacity. If the allocation strategy is lowestPrice, the Spot Fleet terminates the instances with the highest price per unit. If the allocation strategy is capacityOptimized, the Spot Fleet terminates the instances in the Spot Instance pools that have the least available Spot Instance capacity. If the allocation strategy is diversified, the Spot Fleet terminates instances across the Spot Instance pools. Alternatively, you can request that the Spot 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 Spot Fleet for now, but will use it again later, you can set the target capacity to 0.

Method Signature

IMPORTING

Required arguments:

iv_spotfleetrequestid TYPE /AWS1/EC2SPOTFLEETREQUESTID /AWS1/EC2SPOTFLEETREQUESTID

The ID of the Spot Fleet request.

Optional arguments:

it_launchtemplateconfigs TYPE /AWS1/CL_EC2LAUNCHTMPLCONFIG=>TT_LAUNCHTEMPLATECONFIGLIST TT_LAUNCHTEMPLATECONFIGLIST

The launch template and overrides. You can only use this parameter if you specified a launch template (LaunchTemplateConfigs) in your Spot Fleet request. If you specified LaunchSpecifications in your Spot Fleet request, then omit this parameter.

iv_ondemandtargetcapacity TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER

The number of On-Demand Instances in the fleet.

iv_context TYPE /AWS1/EC2STRING /AWS1/EC2STRING

Reserved.

iv_targetcapacity TYPE /AWS1/EC2INTEGER /AWS1/EC2INTEGER

The size of the fleet.

iv_excesscapterminationply TYPE /AWS1/EC2EXCESSCAPTERMINATIO00 /AWS1/EC2EXCESSCAPTERMINATIO00

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

Supported only for fleets of type maintain.

RETURNING

oo_output TYPE REF TO /aws1/cl_ec2modspotfleetreqrsp /AWS1/CL_EC2MODSPOTFLEETREQRSP

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~modifyspotfleetrequest(
  it_launchtemplateconfigs = VALUE /aws1/cl_ec2launchtmplconfig=>tt_launchtemplateconfiglist(
    (
      new /aws1/cl_ec2launchtmplconfig(
        io_launchtemplatespec = new /aws1/cl_ec2fleetlaunchtmpls01(
          iv_launchtemplateid = |string|
          iv_launchtemplatename = |string|
          iv_version = |string|
        )
        it_overrides = VALUE /aws1/cl_ec2launchtmploverri00=>tt_launchtemplateoverrideslist(
          (
            new /aws1/cl_ec2launchtmploverri00(
              io_instancerequirements = new /aws1/cl_ec2instrequirements(
                io_acceleratorcount = new /aws1/cl_ec2acceleratorcount(
                  iv_max = 123
                  iv_min = 123
                )
                io_acceleratortotalmemorymib = new /aws1/cl_ec2acceleratortotal01(
                  iv_max = 123
                  iv_min = 123
                )
                io_baselineebsbandwidthmbps = new /aws1/cl_ec2baselineebsbandw01(
                  iv_max = 123
                  iv_min = 123
                )
                io_baselineperformancefact00 = new /aws1/cl_ec2baselineperforma01(
                  io_cpu = new /aws1/cl_ec2cpuperformancefa01(
                    it_references = VALUE /aws1/cl_ec2performancefacto01=>tt_performancefactorreferenc01(
                      ( new /aws1/cl_ec2performancefacto01( |string| ) )
                    )
                  )
                )
                io_memorygibpervcpu = new /aws1/cl_ec2memorygibpervcpu(
                  iv_max = '0.1'
                  iv_min = '0.1'
                )
                io_memorymib = new /aws1/cl_ec2memorymib(
                  iv_max = 123
                  iv_min = 123
                )
                io_networkbandwidthgbps = new /aws1/cl_ec2networkbandwidth01(
                  iv_max = '0.1'
                  iv_min = '0.1'
                )
                io_networkinterfacecount = new /aws1/cl_ec2networkinterfacect(
                  iv_max = 123
                  iv_min = 123
                )
                io_totallocalstoragegb = new /aws1/cl_ec2totallocalstrggb(
                  iv_max = '0.1'
                  iv_min = '0.1'
                )
                io_vcpucount = new /aws1/cl_ec2vcpucountrange(
                  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
              )
              iv_availabilityzone = |string|
              iv_instancetype = |string|
              iv_priority = '0.1'
              iv_spotprice = |string|
              iv_subnetid = |string|
              iv_weightedcapacity = '0.1'
            )
          )
        )
      )
    )
  )
  iv_context = |string|
  iv_excesscapterminationply = |string|
  iv_ondemandtargetcapacity = 123
  iv_spotfleetrequestid = |string|
  iv_targetcapacity = 123
).

This is an example of reading all possible response values

lv_boolean = lo_result->get_return( ).

To increase the target capacity of a Spot fleet request

This example increases the target capacity of the specified Spot fleet request.

DATA(lo_result) = lo_client->/aws1/if_ec2~modifyspotfleetrequest(
  iv_spotfleetrequestid = |sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE|
  iv_targetcapacity = 20
).