modify_spot_fleet_request
¶
modify_spot_fleet_request(
*,
config_overrides: Optional[EC2ClientConfig] = None,
launch_template_configs: Optional[LaunchTemplateConfigList] = None,
on_demand_target_capacity: Optional[Integer] = None,
context: Optional[String] = None,
spot_fleet_request_id: Optional[SpotFleetRequestId] = None,
target_capacity: Optional[Integer] = None,
excess_capacity_termination_policy: Optional[
ExcessCapacityTerminationPolicy
] = None,
) -> ModifySpotFleetRequestResponse
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.
Parameters:
-
launch_template_configs(Optional[LaunchTemplateConfigList], default:None) –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 specifiedLaunchSpecificationsin your Spot Fleet request, then omit this parameter. -
on_demand_target_capacity(Optional[Integer], default:None) –The number of On-Demand Instances in the fleet.
-
context(Optional[String], default:None) –Reserved.
-
spot_fleet_request_id(Optional[SpotFleetRequestId], default:None) –The ID of the Spot Fleet request.
-
target_capacity(Optional[Integer], default:None) –The size of the fleet.
-
excess_capacity_termination_policy(Optional[ExcessCapacityTerminationPolicy], default:None) –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.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To increase the target capacity of a Spot fleet request This example increases the target capacity of the specified Spot fleet request.
>>> client.modify_spot_fleet_request(spot_fleet_request_id='sfr-73fbd2ce-aa30-494c-8788-1cee4EXAMPLE', target_capacity=20)
Source code in docs_src/capo_ec2/_services/ec2.py
52500 52501 52502 52503 52504 52505 52506 52507 52508 52509 52510 52511 52512 52513 52514 52515 52516 52517 52518 52519 52520 52521 52522 52523 52524 52525 52526 52527 52528 52529 52530 52531 52532 52533 52534 52535 52536 52537 52538 52539 52540 52541 52542 52543 52544 52545 52546 52547 52548 52549 52550 52551 52552 52553 52554 52555 52556 52557 52558 52559 52560 52561 52562 52563 52564 52565 52566 52567 52568 52569 52570 52571 52572 52573 52574 52575 52576 | |