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

PutScalingPolicy

Description

Creates or updates a policy for an Auto Scaling group. To update an existing policy, use the existing policy name and set the parameter(s) 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

Specifies whether the ScalingAdjustment is an absolute number or a percentage of the current capacity. Valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.

For more information about the adjustment types supported by Auto Scaling, see Scale Based on Demand.

Type: String

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

Required: Yes

AutoScalingGroupName

The name or ARN of the Auto Scaling group.

Type: String

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

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 Cooldown Period

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 you want to create or update.

Type: String

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

Required: Yes

ScalingAdjustment

The number of instances by which to scale. AdjustmentType determines the interpretation of this number (e.g., 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: Yes

Response Elements

The following element is returned in a structure named PutScalingPolicyResult.

PolicyARN

A policy's Amazon Resource Name (ARN).

Type: String

Errors

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

LimitExceeded

The quota for capacity groups or launch configurations for this customer has already been reached.

HTTP Status Code: 400

Examples

Sample Request

https://autoscaling.amazonaws.com/?AutoScalingGroupName=my-test-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-test-asg:policyName/my-scal
eout-policy</PolicyARN>
  </PutScalingPolicyResult>
  <ResponseMetadata>
    <RequestId>3cfc6fef-c08b-11e2-a697-2922EXAMPLE</RequestId>
  </ResponseMetadata>
</PutScalingPolicyResponse>