set_desired_capacity
async
¶
set_desired_capacity(
*,
config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
auto_scaling_group_name: Optional[XmlStringMaxLen255] = None,
desired_capacity: Optional[AutoScalingGroupDesiredCapacity] = None,
honor_cooldown: Optional[HonorCooldown] = None,
) -> None
Sets the size of the specified Auto Scaling group.
If a scale-in activity occurs as a result of a new DesiredCapacity value that is lower than the current size of the group, the Auto Scaling group uses its termination policy to determine which instances to terminate.
For more information, see Manual scaling in the Amazon EC2 Auto Scaling User Guide.
Parameters:
-
auto_scaling_group_name(Optional[XmlStringMaxLen255], default:None) –The name of the Auto Scaling group.
-
desired_capacity(Optional[AutoScalingGroupDesiredCapacity], default:None) –The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain.
-
honor_cooldown(Optional[HonorCooldown], default:None) –Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before initiating a scaling activity to set your Auto Scaling group to its new capacity. By default, Amazon EC2 Auto Scaling does not honor the cooldown period during manual scaling activities.
Raises:
-
ResourceContentionFault–You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
ScalingActivityInProgressFault–The operation can't be performed because there are scaling activities in progress.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To set the desired capacity for an Auto Scaling group This example sets the desired capacity for the specified Auto Scaling group.
>>> await client.set_desired_capacity(auto_scaling_group_name='my-auto-scaling-group', desired_capacity=2, honor_cooldown=True)
Source code in docs_src/capo_auto_scaling/_services/async_auto_scaling.py
4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 | |