execute_policy
¶
execute_policy(
*,
config_overrides: Optional[AutoScalingClientConfig] = None,
auto_scaling_group_name: Optional[XmlStringMaxLen255] = None,
policy_name: Optional[ResourceName] = None,
honor_cooldown: Optional[HonorCooldown] = None,
metric_value: Optional[MetricScale] = None,
breach_threshold: Optional[MetricScale] = None,
) -> None
Executes the specified policy. This can be useful for testing the design of your scaling policy.
Parameters:
-
auto_scaling_group_name(Optional[XmlStringMaxLen255], default:None) –The name of the Auto Scaling group.
-
policy_name(Optional[ResourceName], default:None) –The name or ARN of the policy.
-
honor_cooldown(Optional[HonorCooldown], default:None) –Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before executing the policy.
Valid only if the policy type is
SimpleScaling. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide. -
metric_value(Optional[MetricScale], default:None) –The metric value to compare to
BreachThreshold. This enables you to execute a policy of typeStepScalingand determine which step adjustment to use. For example, if the breach threshold is 50 and you want to use a step adjustment with a lower bound of 0 and an upper bound of 10, you can set the metric value to 59.If you specify a metric value that doesn't correspond to a step adjustment for the policy, the call returns an error.
Required if the policy type is
StepScalingand not supported otherwise. -
breach_threshold(Optional[MetricScale], default:None) –The breach threshold for the alarm.
Required if the policy type is
StepScalingand not supported otherwise.
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 execute a scaling policy This example executes the specified policy.
>>> client.execute_policy(auto_scaling_group_name='my-auto-scaling-group', policy_name='my-step-scale-out-policy', breach_threshold=50.0, metric_value=59.0)
Source code in docs_src/capo_auto_scaling/_services/auto_scaling.py
3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 | |