Menu
Auto Scaling
API Reference (API Version 2011-01-01)

PutScalingPolicy

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.

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

AdjustmentType

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.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 255.

Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Required: No

AutoScalingGroupName

The name of the Auto Scaling group.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1600.

Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Required: Yes

Cooldown

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.

Type: Integer

Required: No

EstimatedInstanceWarmup

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.

Type: Integer

Required: No

MetricAggregationType

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.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 32.

Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Required: No

MinAdjustmentMagnitude

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.

Type: Integer

Required: No

MinAdjustmentStep

This parameter has been deprecated.

Available for backward compatibility. Use MinAdjustmentMagnitude instead.

Type: Integer

Required: No

PolicyName

The name of the policy.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 255.

Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Required: Yes

PolicyType

The policy type. The valid values are SimpleScaling, StepScaling, and TargetTrackingScaling. If the policy type is null, the value is treated as SimpleScaling.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Required: No

ScalingAdjustment

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.

Type: Integer

Required: No

StepAdjustments.member.N

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.

Type: Array of StepAdjustment objects

Required: No

TargetTrackingConfiguration

A target tracking policy.

This parameter is required if the policy type is TargetTrackingScaling and not supported otherwise.

Type: TargetTrackingConfiguration object

Required: No

Response Elements

The following elements are returned by the service.

Alarms.member.N

The CloudWatch alarms created for the target tracking policy.

Type: Array of Alarm objects

PolicyARN

The Amazon Resource Name (ARN) of the policy.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1600.

Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Errors

For information about the errors that are common to all actions, see Common Errors.

LimitExceeded

You have already reached a limit for your Auto Scaling resources (for example, groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits.

HTTP Status Code: 400

ResourceContention

You already have a pending update to an Auto Scaling resource (for example, a group, instance, or load balancer).

HTTP Status Code: 500

Example

Sample Request

Copy
https://autoscaling.amazonaws.com/?Action=PutScalingPolicy &AutoScalingGroupName=my-asg &ScalingAdjustment=30 &AdjustmentType=PercentChangeInCapacity &PolicyName=my-scaleout-policy &Version=2011-01-01 &AUTHPARAMS

Sample Response

Copy
<PutScalingPolicyResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/"> <PutScalingPolicyResult> <PolicyARN>arn:aws:autoscaling:us-east-1:123456789012:scalingPolicy:b0dcf5e8-02e6-4e31-9719-0675dEXAMPLE:autoScalingGroupName/my-asg:policyName/my-scaleout-policy</PolicyARN> </PutScalingPolicyResult> <ResponseMetadata> <RequestId>7c6e177f-f082-11e1-ac58-3714bEXAMPLE</RequestId> </ResponseMetadata> </PutScalingPolicyResponse>

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: