set_desired_capacity
¶
set_desired_capacity(
*,
config_overrides: Optional[AutoScalingClientConfig] = 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.
>>> 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/auto_scaling.py
4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 | |