modify_fleet
¶
modify_fleet(
*,
config_overrides: Optional[EC2ClientConfig] = 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/ec2.py
49635 49636 49637 49638 49639 49640 49641 49642 49643 49644 49645 49646 49647 49648 49649 49650 49651 49652 49653 49654 49655 49656 49657 49658 49659 49660 49661 49662 49663 49664 49665 49666 49667 49668 49669 49670 49671 49672 49673 49674 49675 49676 49677 49678 49679 49680 49681 49682 49683 49684 49685 49686 49687 49688 49689 49690 49691 49692 49693 49694 49695 49696 49697 49698 49699 49700 49701 49702 49703 49704 49705 49706 49707 49708 49709 49710 49711 | |