execute_policy
async
¶
execute_policy(
*,
config_overrides: Optional[AsyncAutoScalingClientConfig] = 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.
>>> await 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/async_auto_scaling.py
3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 | |