PutNotificationConfiguration
Configures an Auto Scaling group to send notifications when specified events take place. Subscribers to the specified topic can have messages delivered to an endpoint such as a web server or an email address.
This configuration overwrites any existing configuration.
For more information, see Getting Amazon SNS notifications when your Auto Scaling group scales in the Amazon EC2 Auto Scaling User Guide.
If you exceed your maximum limit of SNS topics, which is 10 per Auto Scaling group, the call fails.
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters (p. 292).
AutoScalingGroupName
The name of the Auto Scaling group.
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
NotificationTypes.member.N
The type of event that causes the notification to be sent. To query the notification types supported by Amazon EC2 Auto Scaling, call the DescribeAutoScalingNotificationTypes (p. 64) API.
Type: Array of strings
Length Constraints: Minimum length of 1. Maximum length of 255.
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
Required: Yes TopicARN
The Amazon Resource Name (ARN) of the Amazon SNS topic.
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
Errors
For information about the errors that are common to all actions, see Common Errors (p. 294).
API Version 2011-01-01 132
Examples
LimitExceeded
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits (p. 53).
HTTP Status Code: 400 ResourceContention
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
HTTP Status Code: 500 ServiceLinkedRoleFailure
The service-linked role is not yet ready for use.
HTTP Status Code: 500
Examples
Example
This example illustrates one usage of PutNotificationConfiguration.
Sample Request
https://autoscaling.amazonaws.com/?Action=PutNotificationConfiguration
&AutoScalingGroupName=my-asg
&TopicARN=arn:aws:us-east-1:123456789012:my-sns-topic
&NotificationTypes.member.1=autoscaling:EC2_INSTANCE_LAUNCH
&Version=2011-01-01
&AUTHPARAMS
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
• AWS Command Line Interface
• AWS SDK for .NET
• AWS SDK for C++
• AWS SDK for Go
• AWS SDK for Java V2
• AWS SDK for JavaScript
• AWS SDK for PHP V3
• AWS SDK for Python
• AWS SDK for Ruby V3
PutScalingPolicy
PutScalingPolicy
Creates or updates a scaling policy for an Auto Scaling group. Scaling policies are used to scale an Auto Scaling group based on configurable metrics. If no policies are defined, the dynamic scaling and predictive scaling features are not used.
For more information about using dynamic scaling, see Target tracking scaling policies and Step and simple scaling policies in the Amazon EC2 Auto Scaling User Guide.
For more information about using predictive scaling, see Predictive scaling for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
You can view the scaling policies for an Auto Scaling group using the DescribePolicies (p. 86) API call. If you are no longer using a scaling policy, you can delete it by calling the DeletePolicy (p. 45) API.
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters (p. 292).
AdjustmentType
Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage). The valid values are ChangeInCapacity, ExactCapacity, and PercentChangeInCapacity.
Required if the policy type is StepScaling or SimpleScaling. For more information, see Scaling adjustment types in the Amazon EC2 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 255.
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
Required: Yes Cooldown
The duration of the policy's cooldown period, in seconds. When a cooldown period is specified here, it overrides the default cooldown period defined for the Auto Scaling group.
Valid only if the policy type is SimpleScaling. For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
Type: Integer Required: No
API Version 2011-01-01 134
Request Parameters
Enabled
Indicates whether the scaling policy is enabled or disabled. The default is enabled. For more
information, see Disabling a scaling policy for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
Type: Boolean Required: No
EstimatedInstanceWarmup
The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. If not provided, the default is to use the value from the default cooldown period for the Auto Scaling group.
Valid only if the policy type is TargetTrackingScaling or StepScaling.
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.
Valid only 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 value to scale by when the adjustment type is PercentChangeInCapacity.
For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify a MinAdjustmentMagnitude of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified a MinAdjustmentMagnitude of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances.
Valid only if the policy type is StepScaling or SimpleScaling. For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide.
NoteSome Auto Scaling groups use instance weights. In this case, set the
MinAdjustmentMagnitude to a value that is at least as large as your largest instance weight.
Type: Integer Required: No MinAdjustmentStep
This parameter has been deprecated.
Available for backward compatibility. Use MinAdjustmentMagnitude instead.
Type: Integer
Request Parameters
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
One of the following policy types:
• TargetTrackingScaling
• StepScaling
• SimpleScaling (default)
• PredictiveScaling 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
PredictiveScalingConfiguration
A predictive scaling policy. Provides support for predefined and custom metrics.
Predefined metrics include CPU utilization, network in/out, and the Application Load Balancer request count.
Required if the policy type is PredictiveScaling.
Type: PredictiveScalingConfiguration (p. 256) object 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. For exact capacity, you must specify a positive value.
Required if the policy type is SimpleScaling. (Not used with any other policy type.) Type: Integer
Required: No
StepAdjustments.member.N
A set of adjustments that enable you to scale based on the size of the alarm breach.
Required if the policy type is StepScaling. (Not used with any other policy type.) Type: Array of StepAdjustment (p. 280) objects
Required: No
API Version 2011-01-01 136
Response Elements
TargetTrackingConfiguration
A target tracking scaling policy. Provides support for predefined or custom metrics.
The following predefined metrics are available:
• ASGAverageCPUUtilization
• ASGAverageNetworkIn
• ASGAverageNetworkOut
• ALBRequestCountPerTarget
If you specify ALBRequestCountPerTarget for the metric, you must specify the ResourceLabel parameter with the PredefinedMetricSpecification.
Required if the policy type is TargetTrackingScaling.
Type: TargetTrackingConfiguration (p. 287) object Required: No
Response Elements
The following elements are returned by the service.
Alarms.member.N
The CloudWatch alarms created for the target tracking scaling policy.
Type: Array of Alarm (p. 179) 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 (p. 294).
LimitExceeded
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits (p. 53).
HTTP Status Code: 400 ResourceContention
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
HTTP Status Code: 500
Examples
ServiceLinkedRoleFailure
The service-linked role is not yet ready for use.
HTTP Status Code: 500
Examples
Example
This example illustrates one usage of PutScalingPolicy.
Sample Request
<PutScalingPolicyResult>
<PolicyARN>arn:aws:autoscaling:us-east-1:123456789012:scalingPolicy:228f02c2-c665-4bfd- aaac-8b04080bea3c:autoScalingGroupName/my-asg:policyName/alb1000-target-tracking-scaling-policy</PolicyARN>
<Alarms>
<member>
<AlarmName>TargetTracking-my-asg-AlarmHigh-fc0e4183-23ac-497e-9992-691c9980c38e</
AlarmName>
<AlarmARN>arn:aws:cloudwatch:us-east-1:123456789012:alarm:TargetTracking-my-asg-AlarmHigh-fc0e4183-23ac-497e-9992-691c9980c38e</AlarmARN>
</member>
<member>
<AlarmName>TargetTracking-my-asg-AlarmLow-61a39305-ed0c-47af-bd9e-471a352ee1a2</
AlarmName>
<AlarmARN>arn:aws:cloudwatch:us-east-1:123456789012:alarm:TargetTracking-my-asg-AlarmLow-61a39305-ed0c-47af-bd9e-471a352ee1a2</AlarmARN>
</member>
</Alarms>
</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:
• AWS Command Line Interface
• AWS SDK for .NET
API Version 2011-01-01 138
See Also
• AWS SDK for C++
• AWS SDK for Go
• AWS SDK for Java V2
• AWS SDK for JavaScript
• AWS SDK for PHP V3
• AWS SDK for Python
• AWS SDK for Ruby V3
PutScheduledUpdateGroupAction
PutScheduledUpdateGroupAction
Creates or updates a scheduled scaling action for an Auto Scaling group.
For more information, see Scheduled scaling in the Amazon EC2 Auto Scaling User Guide.
You can view the scheduled actions for an Auto Scaling group using the
DescribeScheduledActions (p. 95) API call. If you are no longer using a scheduled action, you can delete it by calling the DeleteScheduledAction (p. 47) API.
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters (p. 292).
AutoScalingGroupName
The name of the Auto Scaling group.
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 DesiredCapacity
The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. It can scale beyond this capacity if you add more scaling conditions.
Type: Integer Required: No EndTime
The date and time for the recurring schedule to end, in UTC.
Type: Timestamp Required: No MaxSize
The maximum size of the Auto Scaling group.
Type: Integer Required: No MinSize
The minimum size of the Auto Scaling group.
Type: Integer Required: No
API Version 2011-01-01 140
Request Parameters
Recurrence
The recurring schedule for this action. This format consists of five fields separated by white spaces:
[Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, "30 0 1 1,6,12 *"). For more information about this format, see Crontab.
When StartTime and EndTime are specified with Recurrence, they form the boundaries of when the recurring action starts and stops.
Cron expressions use Universal Coordinated Time (UTC) by default.
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 ScheduledActionName
The name of this scaling action.
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 StartTime
The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example, "2019-06-01T00:00:00Z").
If you specify Recurrence and StartTime, Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.
If you try to schedule your action in the past, Amazon EC2 Auto Scaling returns an error message.
Type: Timestamp Required: No Time
This parameter is no longer used.
Type: Timestamp Required: No TimeZone
Specifies the time zone for a cron expression. If a time zone is not provided, UTC is used by default.
Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as Etc/GMT+9 or Pacific/Tahiti). For more information, see https://
en.wikipedia.org/wiki/List_of_tz_database_time_zones.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 255.
Errors
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
Required: No
Errors
For information about the errors that are common to all actions, see Common Errors (p. 294).
AlreadyExists
You already have an Auto Scaling group or launch configuration with this name.
HTTP Status Code: 400 LimitExceeded
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits (p. 53).
HTTP Status Code: 400 ResourceContention
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
HTTP Status Code: 500
Examples
Example 1: Schedule based on a specific date and time
This example illustrates one usage of PutScheduledUpdateGroupAction.
Sample Request
Example 2: Recurring Schedule
This example illustrates one usage of PutScheduledUpdateGroupAction.
Sample Request
https://autoscaling.amazonaws.com/?Action="PutScheduledUpdateGroupAction
&AutoScalingGroupName=my-asg
&ScheduledActionName=scale-out-schedule-year
&Recurrence="30 0 1 1,6,12 *"
&DesiredCapacity=3
&Version=2011-01-01
API Version 2011-01-01 142
See Also
&AUTHPARAMS
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
• AWS Command Line Interface
• AWS SDK for .NET
• AWS SDK for C++
• AWS SDK for Go
• AWS SDK for Java V2
• AWS SDK for JavaScript
• AWS SDK for PHP V3
• AWS SDK for Python
• AWS SDK for Ruby V3
PutWarmPool
PutWarmPool
Creates or updates a warm pool for the specified Auto Scaling group. A warm pool is a pool of pre-initialized EC2 instances that sits alongside the Auto Scaling group. Whenever your application needs to scale out, the Auto Scaling group can draw on the warm pool to meet its new desired capacity. For more information and example configurations, see Warm pools for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
This operation must be called from the Region in which the Auto Scaling group was created. This operation cannot be called on an Auto Scaling group that has a mixed instances policy or a launch template or launch configuration that requests Spot Instances.
You can view the instances in the warm pool using the DescribeWarmPool (p. 103) API call. If you are no longer using a warm pool, you can delete it by calling the DeleteWarmPool (p. 51) API.
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters (p. 292).
AutoScalingGroupName
The name of the Auto Scaling group.
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 InstanceReusePolicy
Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in.
The default is to terminate instances in the Auto Scaling group when the group scales in.
Type: InstanceReusePolicy (p. 220) object Required: No
MaxGroupPreparedCapacity
Specifies the maximum number of instances that are allowed to be in the warm pool or in any state except Terminated for the Auto Scaling group. This is an optional property. Specify it only if you do not want the warm pool size to be determined by the difference between the group's maximum capacity and its desired capacity.
Important
If a value for MaxGroupPreparedCapacity is not specified, Amazon EC2 Auto Scaling launches and maintains the difference between the group's maximum capacity and its desired capacity. If you specify a value for MaxGroupPreparedCapacity, Amazon EC2 Auto Scaling uses the difference between the MaxGroupPreparedCapacity and the desired capacity instead.
The size of the warm pool is dynamic. Only when MaxGroupPreparedCapacity and MinSize are set to the same value does the warm pool have an absolute size.
If the desired capacity of the Auto Scaling group is higher than the MaxGroupPreparedCapacity, the capacity of the warm pool is 0, unless you specify a value for MinSize. To remove a value that you previously set, include the property but specify -1 for the value.
API Version 2011-01-01 144
Errors
Type: Integer
Valid Range: Minimum value of -1.
Required: No MinSize
Specifies the minimum number of instances to maintain in the warm pool. This helps you to ensure that there is always a certain number of warmed instances available to handle traffic spikes. Defaults to 0 if not specified.
Type: Integer
Valid Range: Minimum value of 0.
Required: No PoolState
Sets the instance state to transition to after the lifecycle actions are complete. Default is Stopped.
Type: String
Valid Values: Stopped | Running | Hibernated Required: No
Errors
For information about the errors that are common to all actions, see Common Errors (p. 294).
LimitExceeded
You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits (p. 53).
HTTP Status Code: 400 ResourceContention
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
HTTP Status Code: 500
Examples
Example
This example illustrates one usage of PutWarmPool.
Sample Request
https://autoscaling.amazonaws.com/?Action=PutWarmPool
&AutoScalingGroupName=my-asg
&MinSize=30
&PoolState=Hibernated
See Also
&InstanceReusePolicy.ReuseOnScaleIn=true
&Version=2011-01-01
&AUTHPARAMS
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following:
• AWS Command Line Interface
• AWS SDK for .NET
• AWS SDK for C++
• AWS SDK for Go
• AWS SDK for Java V2
• AWS SDK for JavaScript
• AWS SDK for PHP V3
• AWS SDK for Python
• AWS SDK for Ruby V3
API Version 2011-01-01 146
RecordLifecycleActionHeartbeat
RecordLifecycleActionHeartbeat
Records a heartbeat for the lifecycle action associated with the specified token or instance. This extends the timeout by the length of time defined using the PutLifecycleHook (p. 128) API call.
This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:
1. (Optional) Create a launch template or launch configuration with a user data script that runs while an instance is in a wait state due to a lifecycle hook.
2. (Optional) Create a Lambda function and a rule that allows Amazon EventBridge to invoke your Lambda function when an instance is put into a wait state due to a lifecycle hook.
3. (Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.
4. Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.
5.If you need more time, record the lifecycle action heartbeat to keep the instance in a wait state.
6. If you finish before the timeout period ends, send a callback by using the CompleteLifecycleAction (p. 19) API call.
For more information, see Amazon EC2 Auto Scaling lifecycle hooks in the Amazon EC2 Auto Scaling User Guide.
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters (p. 292).
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 InstanceId
The ID of the instance.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 19.
Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*
Required: No LifecycleActionToken
Required: No LifecycleActionToken