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
3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 | |