[ aws . autoscaling ]
Gets information about the scaling policies in the account and Region.
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
describe-policies
is a paginated operation. Multiple API calls may be issued in order to retrieve the entire data set of results. You can disable pagination by providing the --no-paginate
argument.
When using --output text
and the --query
argument on a paginated response, the --query
argument must extract data from the results of the following query expressions: ScalingPolicies
describe-policies
[--auto-scaling-group-name <value>]
[--policy-names <value>]
[--policy-types <value>]
[--cli-input-json | --cli-input-yaml]
[--starting-token <value>]
[--page-size <value>]
[--max-items <value>]
[--generate-cli-skeleton <value>]
--auto-scaling-group-name
(string)
The name of the Auto Scaling group.
--policy-names
(list)
The names of one or more policies. If you omit this parameter, all policies are described. If a group name is provided, the results are limited to that group. If you specify an unknown policy name, it is ignored with no error.
Array Members: Maximum number of 50 items.
(string)
Syntax:
"string" "string" ...
--policy-types
(list)
One or more policy types. The valid values are
SimpleScaling
,StepScaling
,TargetTrackingScaling
, andPredictiveScaling
.(string)
Syntax:
"string" "string" ...
--cli-input-json
| --cli-input-yaml
(string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml
.
--starting-token
(string)
A token to specify where to start paginating. This is the
NextToken
from a previously truncated response.For usage examples, see Pagination in the AWS Command Line Interface User Guide .
--page-size
(integer)
The size of each page to get in the AWS service call. This does not affect the number of items returned in the command’s output. Setting a smaller page size results in more calls to the AWS service, retrieving fewer items in each call. This can help prevent the AWS service calls from timing out.
For usage examples, see Pagination in the AWS Command Line Interface User Guide .
--max-items
(integer)
The total number of items to return in the command’s output. If the total number of items available is more than the value specified, a
NextToken
is provided in the command’s output. To resume pagination, provide theNextToken
value in thestarting-token
argument of a subsequent command. Do not use theNextToken
response element directly outside of the AWS CLI.For usage examples, see Pagination in the AWS Command Line Interface User Guide .
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. Similarly, if provided yaml-input
it will print a sample input YAML that can be used with --cli-input-yaml
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
See ‘aws help’ for descriptions of global parameters.
Example 1: To describe the scaling policies of a specified group
This example describes the scaling policies for the specified Auto Scaling group.
aws autoscaling describe-policies \
--auto-scaling-group-name my-asg
Output:
{
"ScalingPolicies": [
{
"AutoScalingGroupName": "my-asg",
"PolicyName": "alb1000-target-tracking-scaling-policy",
"PolicyARN": "arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:3065d9c8-9969-4bec-bb6a-3fbe5550fde6:autoScalingGroupName/my-asg:policyName/alb1000-target-tracking-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"StepAdjustments": [],
"Alarms": [
{
"AlarmName": "TargetTracking-my-asg-AlarmHigh-924887a9-12d7-4e01-8686-6f844d13a196",
"AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmHigh-924887a9-12d7-4e01-8686-6f844d13a196"
},
{
"AlarmName": "TargetTracking-my-asg-AlarmLow-f96f899d-b8e7-4d09-a010-c1aaa35da296",
"AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmLow-f96f899d-b8e7-4d09-a010-c1aaa35da296"
}
],
"TargetTrackingConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "ALBRequestCountPerTarget",
"ResourceLabel": "app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff"
},
"TargetValue": 1000.0,
"DisableScaleIn": false
},
"Enabled": true
},
{
"AutoScalingGroupName": "my-asg",
"PolicyName": "cpu40-target-tracking-scaling-policy",
"PolicyARN": "arn:aws:autoscaling:us-west-2:123456789012:scalingPolicy:5fd26f71-39d4-4690-82a9-b8515c45cdde:autoScalingGroupName/my-asg:policyName/cpu40-target-tracking-scaling-policy",
"PolicyType": "TargetTrackingScaling",
"StepAdjustments": [],
"Alarms": [
{
"AlarmName": "TargetTracking-my-asg-AlarmHigh-139f9789-37b9-42ad-bea5-b5b147d7f473",
"AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmHigh-139f9789-37b9-42ad-bea5-b5b147d7f473"
},
{
"AlarmName": "TargetTracking-my-asg-AlarmLow-bd681c67-fc18-4c56-8468-fb8e413009c9",
"AlarmARN": "arn:aws:cloudwatch:us-west-2:123456789012:alarm:TargetTracking-my-asg-AlarmLow-bd681c67-fc18-4c56-8468-fb8e413009c9"
}
],
"TargetTrackingConfiguration": {
"PredefinedMetricSpecification": {
"PredefinedMetricType": "ASGAverageCPUUtilization"
},
"TargetValue": 40.0,
"DisableScaleIn": false
},
"Enabled": true
}
]
}
For more information, see Dynamic scaling in the Amazon EC2 Auto Scaling User Guide.
Example 2: To describe the scaling policies of a specified name
To return specific scaling policies, use the --policy-names
option.
aws autoscaling describe-policies \
--auto-scaling-group-name my-asg \
--policy-names cpu40-target-tracking-scaling-policy
See example 1 for sample output.
For more information, see Dynamic scaling in the Amazon EC2 Auto Scaling User Guide.
Example 3: To describe a number of scaling policies
To return a specific number of policies, use the --max-items
option.
aws autoscaling describe-policies \
--auto-scaling-group-name my-asg \
--max-items 1
See example 1 for sample output.
If the output includes a NextToken
field, use the value of this field with the --starting-token
option in a subsequent call to get the additional policies.
aws autoscaling describe-policies --auto-scaling-group-name my-asg --starting-token Z3M3LMPEXAMPLE
For more information, see Dynamic scaling in the Amazon EC2 Auto Scaling User Guide.
ScalingPolicies -> (list)
The scaling policies.
(structure)
Describes a scaling policy.
AutoScalingGroupName -> (string)
The name of the Auto Scaling group.
PolicyName -> (string)
The name of the scaling policy.
PolicyARN -> (string)
The Amazon Resource Name (ARN) of the policy.
PolicyType -> (string)
One of the following policy types:
TargetTrackingScaling
StepScaling
SimpleScaling
(default)
PredictiveScaling
For more information, see Target tracking scaling policies and Step and simple scaling policies in the Amazon EC2 Auto Scaling User Guide .
AdjustmentType -> (string)
Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage). The valid values are
ChangeInCapacity
,ExactCapacity
, andPercentChangeInCapacity
.MinAdjustmentStep -> (integer)
Available for backward compatibility. Use
MinAdjustmentMagnitude
instead.MinAdjustmentMagnitude -> (integer)
The minimum value to scale by when the adjustment type is
PercentChangeInCapacity
.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 duration of the policy’s cooldown period, in seconds.
StepAdjustments -> (list)
A set of adjustments that enable you to scale based on the size of the alarm breach.
(structure)
Describes information used to create a step adjustment for a step scaling policy.
For the following examples, suppose that you have an alarm with a breach threshold of 50:
To trigger the adjustment 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.
To trigger the adjustment 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.
For more information, see Step adjustments in the Amazon EC2 Auto Scaling User Guide .
MetricIntervalLowerBound -> (double)
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 -> (double)
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. The valid values are
Minimum
,Maximum
, andAverage
.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.
(structure)
Describes an alarm.
AlarmName -> (string)
The name of the alarm.
AlarmARN -> (string)
The Amazon Resource Name (ARN) of the alarm.
TargetTrackingConfiguration -> (structure)
A target tracking scaling policy.
PredefinedMetricSpecification -> (structure)
A predefined metric. You must specify either a predefined metric or a customized metric.
PredefinedMetricType -> (string)
The metric type. The following predefined metrics are available:
ASGAverageCPUUtilization
- Average CPU utilization of the Auto Scaling group.
ASGAverageNetworkIn
- Average number of bytes received on all network interfaces by the Auto Scaling group.
ASGAverageNetworkOut
- Average number of bytes sent out on all network interfaces by the Auto Scaling group.
ALBRequestCountPerTarget
- Number of requests completed per target in an Application Load Balancer target group.ResourceLabel -> (string)
A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group. You can’t specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
CustomizedMetricSpecification -> (structure)
A customized metric. You must specify either a predefined metric or a customized metric.
MetricName -> (string)
The name of the metric.
Namespace -> (string)
The namespace of the metric.
Dimensions -> (list)
The dimensions of the metric.
Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy.
(structure)
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 -> (double)
The target value for the metric.
DisableScaleIn -> (boolean)
Indicates whether scaling in by the target tracking scaling policy is disabled. If scaling in is disabled, the target tracking scaling policy doesn’t remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is
false
.Enabled -> (boolean)
Indicates whether the policy is enabled (
true
) or disabled (false
).PredictiveScalingConfiguration -> (structure)
A predictive scaling policy.
MetricSpecifications -> (list)
This structure includes the metrics and target utilization to use for predictive scaling.
This is an array, but we currently only support a single metric specification. That is, you can specify a target value and a single metric pair, or a target value and one scaling metric and one load metric.
(structure)
This structure specifies the metrics and target utilization settings for a predictive scaling policy.
You must specify either a metric pair, or a load metric and a scaling metric individually. Specifying a metric pair instead of individual metrics provides a simpler way to configure metrics for a scaling policy. You choose the metric pair, and the policy automatically knows the correct sum and average statistics to use for the load metric and the scaling metric.
Example
You create a predictive scaling policy and specify
ALBRequestCount
as the value for the metric pair and1000.0
as the target value. For this type of metric, you must provide the metric dimension for the corresponding target group, so you also provide a resource label for the Application Load Balancer target group that is attached to your Auto Scaling group.The number of requests the target group receives per minute provides the load metric, and the request count averaged between the members of the target group provides the scaling metric. In CloudWatch, this refers to the
RequestCount
andRequestCountPerTarget
metrics, respectively.For optimal use of predictive scaling, you adhere to the best practice of using a dynamic scaling policy to automatically scale between the minimum capacity and maximum capacity in response to real-time changes in resource utilization.
Amazon EC2 Auto Scaling consumes data points for the load metric over the last 14 days and creates an hourly load forecast for predictive scaling. (A minimum of 24 hours of data is required.)
After creating the load forecast, Amazon EC2 Auto Scaling determines when to reduce or increase the capacity of your Auto Scaling group in each hour of the forecast period so that the average number of requests received by each instance is as close to 1000 requests per minute as possible at all times.
TargetValue -> (double)
Specifies the target utilization.
PredefinedMetricPairSpecification -> (structure)
The metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use.
PredefinedMetricType -> (string)
Indicates which metrics to use. There are two different types of metrics for each metric type: one is a load metric and one is a scaling metric. For example, if the metric type is
ASGCPUUtilization
, the Auto Scaling group’s total CPU metric is used as the load metric, and the average CPU metric is used for the scaling metric.ResourceLabel -> (string)
A label that uniquely identifies a specific Application Load Balancer target group from which to determine the total and average request count served by your Auto Scaling group. You can’t specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
PredefinedScalingMetricSpecification -> (structure)
The scaling metric specification.
PredefinedMetricType -> (string)
The metric type.
ResourceLabel -> (string)
A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group. You can’t specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
PredefinedLoadMetricSpecification -> (structure)
The load metric specification.
PredefinedMetricType -> (string)
The metric type.
ResourceLabel -> (string)
A label that uniquely identifies a specific Application Load Balancer target group from which to determine the request count served by your Auto Scaling group. You can’t specify a resource label unless the target group is attached to the Auto Scaling group.
You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is:
app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff
.Where:
app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN
targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN.
To find the ARN for an Application Load Balancer, use the DescribeLoadBalancers API operation. To find the ARN for the target group, use the DescribeTargetGroups API operation.
Mode -> (string)
The predictive scaling mode. Defaults to
ForecastOnly
if not specified.SchedulingBufferTime -> (integer)
The amount of time, in seconds, by which the instance launch time can be advanced. For example, the forecast says to add capacity at 10:00 AM, and you choose to pre-launch instances by 5 minutes. In that case, the instances will be launched at 9:55 AM. The intention is to give resources time to be provisioned. It can take a few minutes to launch an EC2 instance. The actual amount of time required depends on several factors, such as the size of the instance and whether there are startup scripts to complete.
The value must be less than the forecast interval duration of 3600 seconds (60 minutes). Defaults to 300 seconds if not specified.
MaxCapacityBreachBehavior -> (string)
Defines the behavior that should be applied if the forecast capacity approaches or exceeds the maximum capacity of the Auto Scaling group. Defaults to
HonorMaxCapacity
if not specified.The following are possible values:
HonorMaxCapacity
- Amazon EC2 Auto Scaling cannot scale out capacity higher than the maximum capacity. The maximum capacity is enforced as a hard limit.
IncreaseMaxCapacity
- Amazon EC2 Auto Scaling can scale out capacity higher than the maximum capacity when the forecast capacity is close to or exceeds the maximum capacity. The upper limit is determined by the forecasted capacity and the value forMaxCapacityBuffer
.MaxCapacityBuffer -> (integer)
The size of the capacity buffer to use when the forecast capacity is close to or exceeds the maximum capacity. The value is specified as a percentage relative to the forecast capacity. For example, if the buffer is 10, this means a 10 percent buffer, such that if the forecast capacity is 50, and the maximum capacity is 40, then the effective maximum capacity is 55.
If set to 0, Amazon EC2 Auto Scaling may scale capacity higher than the maximum capacity to equal but not exceed forecast capacity.
Required if the
MaxCapacityBreachBehavior
property is set toIncreaseMaxCapacity
, and cannot be used otherwise.
NextToken -> (string)
A string that indicates that the response contains more items than can be returned in a single response. To receive additional items, specify this string for the
NextToken
value when requesting the next set of items. This value is null when there are no more items to return.