Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::AutoScaling::ScheduledAction

Creates a scheduled scaling action for an Auto Scaling group, changing the number of servers available for your application in response to predictable load changes.

Important

Note the following:

  • If you have rolling updates enabled, you must suspend scheduled actions before you can update the Auto Scaling group. You can suspend processes by using the AWS CLI or Auto Scaling API. For more information, see Suspend and Resume Auto Scaling Process in the Auto Scaling User Guide.

  • When you update a stack with an Auto Scaling group and scheduled action, AWS CloudFormation always sets the min size, max size, and desired capacity properties of your Auto Scaling group to the values that are defined in the AWS::AutoScaling::AutoScalingGroup resource of your template, even if a scheduled action is in effect. However, you might not want AWS CloudFormation to change any of the group size property values, such as when you have a scheduled action in effect. You can use an UpdatePolicy attribute to prevent AWS CloudFormation from changing the min size, max size, or desired capacity property values during a stack update unless you modified the individual values in your template.

Syntax

{
  "Type" : "AWS::AutoScaling::ScheduledAction",
  "Properties" : {
    "AutoScalingGroupName" : String,
    "DesiredCapacity" : Integer,
    "EndTime" : Time stamp,
    "MaxSize" : Integer,
    "MinSize" : Integer,
    "Recurrence" : String,
    "StartTime" : Time stamp
  }
}

Properties

AutoScalingGroupName

The name or ARN of the Auto Scaling group.

Required: Yes

Type: String

Update requires: Replacement

DesiredCapacity

The number of Amazon EC2 instances that should be running in the Auto Scaling group.

Required: No

Type: Integer

Update requires: No interruption

EndTime

The time in UTC for this schedule to end. For example, 2010-06-01T00:00:00Z.

Required: No

Type: Time stamp

Update requires: No interruption

MaxSize

The maximum number of Amazon EC2 instances in the Auto Scaling group.

Required: No

Type: Integer

Update requires: No interruption

MinSize

The minimum number of Amazon EC2 instances in the Auto Scaling group.

Required: No

Type: Integer

Update requires: No interruption

Recurrence

The time in UTC when recurring future actions will start. You specify the start time by following the Unix cron syntax format. For more information about cron syntax, go to http://en.wikipedia.org/wiki/Cron.

Specifying the StartTime and EndTime properties with Recurrence property forms the start and stop boundaries of the recurring action.

Required: No

Type: String

Update requires: No interruption

StartTime

The time in UTC for this schedule to start. For example, 2010-06-01T00:00:00Z.

Required: No

Type: Time stamp

Update requires: No interruption

Return Value

When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the resource name. For example:

{ "Ref": "MyScheduledAction" }

For a scheduled Auto Scaling action with the logical ID MyScheduledAction, Ref returns the scheduled action name. For example:

mystack-myscheduledaction-NT5EUXTNTXXD

For more information about using the Ref function, see Ref.

Auto Scaling Scheduled Action Snippet

The following template snippet includes two scheduled actions that scale the number of instances in an Auto Scaling group. The ScheduledActionUp action starts at 7 AM every day and sets the Auto Scaling group to a minimum of five Amazon EC2 instances with a maximum of 10. The ScheduledActionDown action starts at 7 PM every day and sets the Auto Scaling group to a minimum and maximum of one Amazon EC2 instance.

"ScheduledActionUp": {
  "Type": "AWS::AutoScaling::ScheduledAction",
  "Properties": {
    "AutoScalingGroupName": {
      "Ref": "WebServerGroup"
    },
    "MaxSize": "10",
    "MinSize": "5",
    "Recurrence": "0 7 * * *"
  }
},
"ScheduledActionDown": {
  "Type": "AWS::AutoScaling::ScheduledAction",
  "Properties": {
    "AutoScalingGroupName": {
      "Ref": "WebServerGroup"
    },
    "MaxSize": "1",
    "MinSize": "1",
    "Recurrence": "0 19 * * *"
  }
}