modify_spot_fleet_request
async
¶
modify_spot_fleet_request(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = 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.
>>> await 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/async_ec2.py
53231 53232 53233 53234 53235 53236 53237 53238 53239 53240 53241 53242 53243 53244 53245 53246 53247 53248 53249 53250 53251 53252 53253 53254 53255 53256 53257 53258 53259 53260 53261 53262 53263 53264 53265 53266 53267 53268 53269 53270 53271 53272 53273 53274 53275 53276 53277 53278 53279 53280 53281 53282 53283 53284 53285 53286 53287 53288 53289 53290 53291 53292 53293 53294 53295 53296 53297 53298 53299 53300 53301 53302 53303 53304 53305 53306 53307 53308 | |