modify_fleet
async
¶
modify_fleet(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
dry_run: Optional[Boolean] = None,
excess_capacity_termination_policy: Optional[
FleetExcessCapacityTerminationPolicy
] = None,
launch_template_configs: Optional[FleetLaunchTemplateConfigListRequest] = None,
fleet_id: Optional[FleetId] = None,
target_capacity_specification: Optional[TargetCapacitySpecificationRequest] = None,
context: Optional[String] = None,
) -> ModifyFleetResult
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.
Parameters:
-
dry_run(Optional[Boolean], default:None) –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 isUnauthorizedOperation. -
excess_capacity_termination_policy(Optional[FleetExcessCapacityTerminationPolicy], default:None) –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. -
launch_template_configs(Optional[FleetLaunchTemplateConfigListRequest], default:None) –The launch template and overrides.
-
fleet_id(Optional[FleetId], default:None) –The ID of the EC2 Fleet.
-
target_capacity_specification(Optional[TargetCapacitySpecificationRequest], default:None) –The size of the EC2 Fleet.
-
context(Optional[String], default:None) –Reserved.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_ec2/_services/async_ec2.py
50320 50321 50322 50323 50324 50325 50326 50327 50328 50329 50330 50331 50332 50333 50334 50335 50336 50337 50338 50339 50340 50341 50342 50343 50344 50345 50346 50347 50348 50349 50350 50351 50352 50353 50354 50355 50356 50357 50358 50359 50360 50361 50362 50363 50364 50365 50366 50367 50368 50369 50370 50371 50372 50373 50374 50375 50376 50377 50378 50379 50380 50381 50382 50383 50384 50385 50386 50387 50388 50389 50390 50391 50392 50393 50394 50395 50396 50397 50398 50399 | |