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
3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 | |