Auto Scaling
API Reference (API Version 2011-01-01)
Did this page help you?  Yes | No |  Tell us about it...
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.

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.

Request Parameters

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

AdjustmentType

The adjustment type. Valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.

For more information, see Dynamic Scaling in the Auto Scaling Developer 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: Yes

AutoScalingGroupName

The name or ARN of the 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.

For more information, see Understanding Auto Scaling Cooldowns in the Auto Scaling Developer Guide.

Type: Integer

Required: No

MinAdjustmentStep

Used with AdjustmentType with the value PercentChangeInCapacity, the scaling policy changes the DesiredCapacity of the Auto Scaling group by at least the number of instances specified in the value.

You will get a ValidationError if you use MinAdjustmentStep on a policy with an AdjustmentType other than PercentChangeInCapacity.

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

ScalingAdjustment

The number of instances by which to scale. AdjustmentType determines the interpretation of this number (for example, as an absolute number or as a percentage of the existing Auto Scaling group size). A positive increment adds to the current capacity and a negative value removes from the current capacity.

Type: Integer

Required: No

Response Elements

The following element is returned.

PolicyARN

The Amazon Resource Name (ARN) of the policy.

Type: String

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

Examples

Sample Request

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

Sample Response

<PutScalingPolicyResponse xmlns="http://autoscaling.amazonaws.com/doc/2011-01-01/">
  <PutScalingPolicyResult>
    <PolicyARN>arn:aws:autoscaling:us-east-1:803981987763:scalingPolicy:b0dcf5e8
-02e6-4e31-9719-0675d0dc31ae:autoScalingGroupName/my-asg:policyName/my-scal
eout-policy</PolicyARN>
  </PutScalingPolicyResult>
  <ResponseMetadata>
    <RequestId>3cfc6fef-c08b-11e2-a697-2922EXAMPLE</RequestId>
  </ResponseMetadata>
</PutScalingPolicyResponse>