Amazon EC2 Auto Scaling
User Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Scheduled Scaling for Amazon EC2 Auto Scaling

Scaling based on a schedule allows you to set your own scaling schedule for predictable load changes. For example, every week the traffic to your web application starts to increase on Wednesday, remains high on Thursday, and starts to decrease on Friday. You can plan your scaling actions based on the predictable traffic patterns of your web application. Scaling actions are performed automatically as a function of time and date.

Note

For scaling based on predictable load changes, you can also use the predictive scaling feature of AWS Auto Scaling. For more information, see the AWS Auto Scaling User Guide.

To configure your Auto Scaling group to scale based on a schedule, you create a scheduled action. The scheduled action tells Amazon EC2 Auto Scaling to perform a scaling action at specified times. To create a scheduled scaling action, you specify the start time when the scaling action should take effect, and the new minimum, maximum, and desired sizes for the scaling action. At the specified time, Amazon EC2 Auto Scaling updates the group with the values for minimum, maximum, and desired size specified by the scaling action.

You can create scheduled actions for scaling one time only or for scaling on a recurring schedule.

Considerations

When you create a scheduled action, keep the following in mind.

  • The order of execution for scheduled actions is guaranteed within the same group, but not for scheduled actions across groups.

  • A scheduled action generally executes within seconds. However, the action may be delayed for up to two minutes from the scheduled start time. Because actions within an Auto Scaling group are executed in the order that they are specified, scheduled actions with scheduled start times close to each other can take longer to execute.

  • You can create a maximum of 125 scheduled actions per Auto Scaling group.

  • A scheduled action must have a unique time value. If you attempt to schedule an activity at a time when another scaling activity is already scheduled, the call is rejected with an error message noting the conflict.

  • A scheduled action does not persist in your account once it has reached its end time.

  • You can temporarily disable scheduled scaling without deleting your scheduled actions. For more information, see Suspending and Resuming Scaling Processes.

  • Cooldown periods are not supported.

  • You can also schedule scaling actions for resources beyond Amazon EC2. For more information, see Scheduled Scaling in the Application Auto Scaling User Guide.

Create and Manage Scheduled Actions (Console)

You can create scheduled actions that scale one time only or that scale on a recurring schedule using the console. Complete the following procedure to create a scheduled action to scale your Auto Scaling group.

To create a scheduled action for an Auto Scaling group

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, under Auto Scaling, choose Auto Scaling Groups.

  3. Select your Auto Scaling group.

  4. On the Scheduled Actions tab, choose Create Scheduled Action.

  5. On the Create Scheduled Action page, do the following:

    • Specify the size of the group using at least one of the following values: Min, Max, or Desired Capacity.

    • Choose an option for Recurrence. If you choose Once, the action is performed at the specified time. If you select Cron, type a cron expression that specifies when to perform the action, in UTC. If you select an option that begins with Every, the cron expression is created for you.

    • If you chose Once for Recurrence, specify the time for the action in Start Time.

    • If you specified a recurring schedule, you can specify values for Start Time and End Time. If you specify a start time, the earliest time the action is performed is at this time. If you specify an end time, the action is not performed after this time.

  6. Choose Create.

Update a Scheduled Action

If your requirements change, you can update a scheduled action.

To update a scheduled action

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, under Auto Scaling, choose Auto Scaling Groups.

  3. Select your Auto Scaling group.

  4. On the Scheduled Actions tab, select the scheduled action.

  5. Choose Actions, Edit.

  6. On the Edit Scheduled Action page, do the following:

    • Update the size of the group as needed using Min, Max, or Desired Capacity.

    • Update the specified recurrence as needed.

    • Update the start and end time as needed.

    • Choose Save.

Delete a Scheduled Action

When you no longer need a scheduled action, you can delete it.

To delete a scheduled action

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, under Auto Scaling, choose Auto Scaling Groups.

  3. Select your Auto Scaling group.

  4. On the Scheduled Actions tab, select the scheduled action.

  5. Choose Actions, Delete.

  6. When prompted for confirmation, choose Yes, Delete.

Create and Manage Scheduled Actions (AWS CLI)

You can create and update scheduled actions that scale one time only or that scale on a recurring schedule using the put-scheduled-update-group-action command.

To scale one time only

You can specify a one-time schedule to automatically scale your Auto Scaling group at a certain date and time, in UTC.

  • To decrease the number of running instances in your Auto Scaling group at a specific time, use the following command. At the date and time specified for --start-time, if the group currently has more than 1 instance, the group scales in to 1 instance.

    aws autoscaling put-scheduled-update-group-action --scheduled-action-name my-one-time-action \ --auto-scaling-group-name my-asg --start-time "2019-05-13T08:00:00Z" --desired-capacity 1
  • To increase the number of running instances in your Auto Scaling group at a specific time, use the following command. At the date and time specified for --start-time, if the group currently has fewer than 3 instances, the group scales out to 3 instances.

    aws autoscaling put-scheduled-update-group-action --scheduled-action-name my-one-time-action \ --auto-scaling-group-name my-asg --start-time "2019-05-12T08:00:00Z" --desired-capacity 3

To scale on a recurring schedule

You can specify a recurrence schedule, in UTC, using the Unix cron syntax format. This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. For more information about this format, see Crontab.

Use the following put-scheduled-update-group-action command to create a scheduled action that runs at 00:30 hours on the first of January, June, and December each year.

aws autoscaling put-scheduled-update-group-action --scheduled-action-name my-recurring-action \ --auto-scaling-group-name my-asg --recurrence "30 0 1 1,6,12 *" --desired-capacity 3

Delete a Scheduled Action

To delete a scheduled action

Use the following delete-scheduled-action command.

aws autoscaling delete-scheduled-action --scheduled-action-name my-recurring-action