2017/07/12 - Auto Scaling - 2 updated api methods
Changes Update autoscaling client to latest version
{'ScalingPolicies': {'TargetTrackingConfiguration': {'CustomizedMetricSpecification': {'Dimensions': [{'Name': 'string', 'Value': 'string'}], 'MetricName': 'string', 'Namespace': 'string', 'Statistic': 'Average ' '| ' 'Minimum ' '| ' 'Maximum ' '| ' 'SampleCount ' '| ' 'Sum', 'Unit': 'string'}, 'DisableScaleIn': 'boolean', 'PredefinedMetricSpecification': {'PredefinedMetricType': 'ASGAverageCPUUtilization ' '| ' 'ASGAverageNetworkIn ' '| ' 'ASGAverageNetworkOut ' '| ' 'ALBRequestCountPerTarget', 'ResourceLabel': 'string'}, 'TargetValue': 'double'}}}
Describes the policies for the specified Auto Scaling group.
See also: AWS API Documentation
Request Syntax
client.describe_policies( AutoScalingGroupName='string', PolicyNames=[ 'string', ], PolicyTypes=[ 'string', ], NextToken='string', MaxRecords=123 )
string
The name of the group.
list
One or more policy names or policy ARNs to be described. If you omit this parameter, all policy names are described. If an group name is provided, the results are limited to that group. This list is limited to 50 items. If you specify an unknown policy name, it is ignored with no error.
(string) --
list
One or more policy types. Valid values are SimpleScaling and StepScaling.
(string) --
string
The token for the next set of items to return. (You received this token from a previous call.)
integer
The maximum number of items to be returned with each call. The default value is 50 and the maximum value is 100.
dict
Response Syntax
{ 'ScalingPolicies': [ { 'AutoScalingGroupName': 'string', 'PolicyName': 'string', 'PolicyARN': 'string', 'PolicyType': 'string', 'AdjustmentType': 'string', 'MinAdjustmentStep': 123, 'MinAdjustmentMagnitude': 123, 'ScalingAdjustment': 123, 'Cooldown': 123, 'StepAdjustments': [ { 'MetricIntervalLowerBound': 123.0, 'MetricIntervalUpperBound': 123.0, 'ScalingAdjustment': 123 }, ], 'MetricAggregationType': 'string', 'EstimatedInstanceWarmup': 123, 'Alarms': [ { 'AlarmName': 'string', 'AlarmARN': 'string' }, ], 'TargetTrackingConfiguration': { 'PredefinedMetricSpecification': { 'PredefinedMetricType': 'ASGAverageCPUUtilization'|'ASGAverageNetworkIn'|'ASGAverageNetworkOut'|'ALBRequestCountPerTarget', 'ResourceLabel': 'string' }, 'CustomizedMetricSpecification': { 'MetricName': 'string', 'Namespace': 'string', 'Dimensions': [ { 'Name': 'string', 'Value': 'string' }, ], 'Statistic': 'Average'|'Minimum'|'Maximum'|'SampleCount'|'Sum', 'Unit': 'string' }, 'TargetValue': 123.0, 'DisableScaleIn': True|False } }, ], 'NextToken': 'string' }
Response Structure
(dict) --
Contains the output of DescribePolicies.
ScalingPolicies (list) --
The scaling policies.
(dict) --
Describes a scaling policy.
AutoScalingGroupName (string) --
The name of the Auto Scaling group associated with this scaling policy.
PolicyName (string) --
The name of the scaling policy.
PolicyARN (string) --
The Amazon Resource Name (ARN) of the policy.
PolicyType (string) --
The policy type. Valid values are SimpleScaling and StepScaling.
AdjustmentType (string) --
The adjustment type, which specifies how ScalingAdjustment is interpreted. Valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.
MinAdjustmentStep (integer) --
Available for backward compatibility. Use MinAdjustmentMagnitude instead.
MinAdjustmentMagnitude (integer) --
The minimum number of instances to scale. If the value of AdjustmentType is PercentChangeInCapacity, the scaling policy changes the DesiredCapacity of the Auto Scaling group by at least this many instances. Otherwise, the error is ValidationError.
ScalingAdjustment (integer) --
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
Cooldown (integer) --
The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.
StepAdjustments (list) --
A set of adjustments that enable you to scale based on the size of the alarm breach.
(dict) --
Describes an adjustment based on the difference between the value of the aggregated CloudWatch metric and the breach threshold that you've defined for the alarm.
For the following examples, suppose that you have an alarm with a breach threshold of 50:
If you want the adjustment to be triggered when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.
If you want the adjustment to be triggered when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
There are a few rules for the step adjustments for your step policy:
The ranges of your step adjustments can't overlap or have a gap.
At most one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.
At most one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.
The upper and lower bound can't be null in the same step adjustment.
MetricIntervalLowerBound (float) --
The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.
MetricIntervalUpperBound (float) --
The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.
The upper bound must be greater than the lower bound.
ScalingAdjustment (integer) --
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
MetricAggregationType (string) --
The aggregation type for the CloudWatch metrics. Valid values are Minimum, Maximum, and Average.
EstimatedInstanceWarmup (integer) --
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics.
Alarms (list) --
The CloudWatch alarms related to the policy.
(dict) --
Describes an alarm.
AlarmName (string) --
The name of the alarm.
AlarmARN (string) --
The Amazon Resource Name (ARN) of the alarm.
TargetTrackingConfiguration (dict) --
A target tracking policy.
PredefinedMetricSpecification (dict) --
A predefined metric. You can specify either a predefined metric or a customized metric.
PredefinedMetricType (string) --
The metric type.
ResourceLabel (string) --
Identifies the resource associated with the metric type. For predefined metric types ASGAverageCPUUtilization, ASGAverageNetworkIn and ASGAverageNetworkOut, the parameter must not be specified as the resource associated with the metric type is the Auto Scaling group. For predefined metric type ALBRequestCountPerTarget, the parameter must be specified in the format app/load-balancer-name/load-balancer-id/targetgroup/target-group-name/target-group-id ``, where ``app/load-balancer-name/load-balancer-id is the final portion of the load balancer ARN, and targetgroup/target-group-name/target-group-id is the final portion of the target group ARN. The target group must be attached to the Auto Scaling group.
CustomizedMetricSpecification (dict) --
A customized metric.
MetricName (string) --
The name of the metric.
Namespace (string) --
The namespace of the metric.
Dimensions (list) --
The dimensions of the metric.
(dict) --
Describes the dimension of a metric.
Name (string) --
The name of the dimension.
Value (string) --
The value of the dimension.
Statistic (string) --
The statistic of the metric.
Unit (string) --
The unit of the metric.
TargetValue (float) --
The target value for the metric.
DisableScaleIn (boolean) --
If the parameter is true, then scale-in will be disabled for the target tracking policy, i.e. the target tracking policy will not scale in the Auto Scaling group. The default value is false.
NextToken (string) --
The token to use when requesting the next set of items. If there are no additional items to return, the string is empty.
{'TargetTrackingConfiguration': {'CustomizedMetricSpecification': {'Dimensions': [{'Name': 'string', 'Value': 'string'}], 'MetricName': 'string', 'Namespace': 'string', 'Statistic': 'Average ' '| ' 'Minimum ' '| ' 'Maximum ' '| ' 'SampleCount ' '| ' 'Sum', 'Unit': 'string'}, 'DisableScaleIn': 'boolean', 'PredefinedMetricSpecification': {'PredefinedMetricType': 'ASGAverageCPUUtilization ' '| ' 'ASGAverageNetworkIn ' '| ' 'ASGAverageNetworkOut ' '| ' 'ALBRequestCountPerTarget', 'ResourceLabel': 'string'}, 'TargetValue': 'double'}}Response
{'Alarms': [{'AlarmARN': 'string', 'AlarmName': 'string'}]}
Creates or updates a policy for an Auto Scaling group. To update an existing policy, use the existing policy name and set the parameters you want to change. Any existing parameter not changed in an update to an existing policy is not changed in this update request.
If you exceed your maximum limit of step adjustments, which by default is 20 per region, the call fails. For information about updating this limit, see AWS Service Limits in the Amazon Web Services General Reference.
See also: AWS API Documentation
Request Syntax
client.put_scaling_policy( AutoScalingGroupName='string', PolicyName='string', PolicyType='string', AdjustmentType='string', MinAdjustmentStep=123, MinAdjustmentMagnitude=123, ScalingAdjustment=123, Cooldown=123, MetricAggregationType='string', StepAdjustments=[ { 'MetricIntervalLowerBound': 123.0, 'MetricIntervalUpperBound': 123.0, 'ScalingAdjustment': 123 }, ], EstimatedInstanceWarmup=123, TargetTrackingConfiguration={ 'PredefinedMetricSpecification': { 'PredefinedMetricType': 'ASGAverageCPUUtilization'|'ASGAverageNetworkIn'|'ASGAverageNetworkOut'|'ALBRequestCountPerTarget', 'ResourceLabel': 'string' }, 'CustomizedMetricSpecification': { 'MetricName': 'string', 'Namespace': 'string', 'Dimensions': [ { 'Name': 'string', 'Value': 'string' }, ], 'Statistic': 'Average'|'Minimum'|'Maximum'|'SampleCount'|'Sum', 'Unit': 'string' }, 'TargetValue': 123.0, 'DisableScaleIn': True|False } )
string
[REQUIRED]
The name or ARN of the group.
string
[REQUIRED]
The name of the policy.
string
The policy type. The valid values are SimpleScaling, StepScaling, and TargetTrackingScaling. If the policy type is null, the value is treated as SimpleScaling.
string
The adjustment type. The valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.
This parameter is supported if the policy type is SimpleScaling or StepScaling.
For more information, see Dynamic Scaling in the Auto Scaling User Guide.
integer
Available for backward compatibility. Use MinAdjustmentMagnitude instead.
integer
The minimum number of instances to scale. If the value of AdjustmentType is PercentChangeInCapacity, the scaling policy changes the DesiredCapacity of the Auto Scaling group by at least this many instances. Otherwise, the error is ValidationError.
This parameter is supported if the policy type is SimpleScaling or StepScaling.
integer
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
This parameter is required if the policy type is SimpleScaling and not supported otherwise.
integer
The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. If this parameter is not specified, the default cooldown period for the group applies.
This parameter is supported if the policy type is SimpleScaling.
For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide.
string
The aggregation type for the CloudWatch metrics. The valid values are Minimum, Maximum, and Average. If the aggregation type is null, the value is treated as Average.
This parameter is supported if the policy type is StepScaling.
list
A set of adjustments that enable you to scale based on the size of the alarm breach.
This parameter is required if the policy type is StepScaling and not supported otherwise.
(dict) --
Describes an adjustment based on the difference between the value of the aggregated CloudWatch metric and the breach threshold that you've defined for the alarm.
For the following examples, suppose that you have an alarm with a breach threshold of 50:
If you want the adjustment to be triggered when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.
If you want the adjustment to be triggered when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
There are a few rules for the step adjustments for your step policy:
The ranges of your step adjustments can't overlap or have a gap.
At most one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.
At most one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.
The upper and lower bound can't be null in the same step adjustment.
MetricIntervalLowerBound (float) --
The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.
MetricIntervalUpperBound (float) --
The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.
The upper bound must be greater than the lower bound.
ScalingAdjustment (integer) -- [REQUIRED]
The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
integer
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. The default is to use the value specified for the default cooldown period for the group.
This parameter is supported if the policy type is StepScaling or TargetTrackingScaling.
dict
The configuration of a target tracking policy.
This parameter is required if the policy type is TargetTrackingScaling and not supported otherwise.
PredefinedMetricSpecification (dict) --
A predefined metric. You can specify either a predefined metric or a customized metric.
PredefinedMetricType (string) -- [REQUIRED]
The metric type.
ResourceLabel (string) --
Identifies the resource associated with the metric type. For predefined metric types ASGAverageCPUUtilization, ASGAverageNetworkIn and ASGAverageNetworkOut, the parameter must not be specified as the resource associated with the metric type is the Auto Scaling group. For predefined metric type ALBRequestCountPerTarget, the parameter must be specified in the format app/load-balancer-name/load-balancer-id/targetgroup/target-group-name/target-group-id ``, where ``app/load-balancer-name/load-balancer-id is the final portion of the load balancer ARN, and targetgroup/target-group-name/target-group-id is the final portion of the target group ARN. The target group must be attached to the Auto Scaling group.
CustomizedMetricSpecification (dict) --
A customized metric.
MetricName (string) -- [REQUIRED]
The name of the metric.
Namespace (string) -- [REQUIRED]
The namespace of the metric.
Dimensions (list) --
The dimensions of the metric.
(dict) --
Describes the dimension of a metric.
Name (string) -- [REQUIRED]
The name of the dimension.
Value (string) -- [REQUIRED]
The value of the dimension.
Statistic (string) -- [REQUIRED]
The statistic of the metric.
Unit (string) --
The unit of the metric.
TargetValue (float) -- [REQUIRED]
The target value for the metric.
DisableScaleIn (boolean) --
If the parameter is true, then scale-in will be disabled for the target tracking policy, i.e. the target tracking policy will not scale in the Auto Scaling group. The default value is false.
dict
Response Syntax
{ 'PolicyARN': 'string', 'Alarms': [ { 'AlarmName': 'string', 'AlarmARN': 'string' }, ] }
Response Structure
(dict) --
Contains the output of PutScalingPolicy.
PolicyARN (string) --
The Amazon Resource Name (ARN) of the policy.
Alarms (list) --
The CloudWatch alarms created for the target tracking policy. This parameter will be empty if the policy type is anything other than TargetTrackingScaling.
(dict) --
Describes an alarm.
AlarmName (string) --
The name of the alarm.
AlarmARN (string) --
The Amazon Resource Name (ARN) of the alarm.