I want to use Amazon Elastic Compute Cloud (Amazon EC2) Auto Scaling scheduled actions to proactively spin up capacity for specific events and troubleshoot my scheduled actions.
Short description
Scheduled actions are used to scale capacity according to traffic patterns or expected future traffic. For example, you might have an application that experiences increased traffic for the same two-hour time period every day. Or, you might be planning for an upcoming, one-time event where you expect traffic to significantly spike over the course of a few minutes. Scheduled actions are run at the time that you specify (in UTC). Scaling occurs based on the values that you set for the minimum, maximum, and desired capacity.
Resolution
Create a scheduled action for an Auto Scaling group
- Open the Amazon EC2 console.
- From the navigation pane, choose Auto Scaling.
- Select the Auto Scaling group where you want to configure your scheduled actions.
- On the Automatic scaling tab, under Scheduled actions, choose Create scheduled action.
- Enter a Name for your scheduled action.
- Enter the size of your Auto Scaling group. You must enter at least one of the following parameters:
For Min, enter the minimum number of instances required in the group.
For Max, enter the maximum number of instances that can exist in the group.
Note: It's a best practice to set the Min and Max parameters when you have scaling policies and scheduled actions. The number of instances must be within the Min and Max range, even if a scaling policy is activated after the scheduled action starts.
For Desired, enter the number of instances required for the event.
- Choose the schedule to activate your scheduled action.
For a one-time event: Choose Once for Recurrence. For Start time, select the timestamp for your event.
For a recurring event: Select the recurrence interval. For Start time, select the timestamp for the first run of the scheduled action. If you select Recurrence and Start time, the service performs the action at the start time, and then performs the action based on the recurrence. (Optional) Select an End time to set an end date for the recurring scheduled action.
Note: If the required recurrence interval option isn't available, choose cron for Recurrence. Then, use the Unix cron syntax format to write a custom cron expression for the required schedule. For more information, see crontab - tables for driving cron on the crontab website.
- Choose Create.
Troubleshoot issues with your scheduled action
If the scheduled action wasn't activated as expected:
- Check the activity history for the Auto Scaling group for the time period when the scheduled action was expected to start. If there's no related activity, then review your scheduled action's configuration. Check that the recurrence pattern and start time are configured as intended.
- For recurring actions: If you selected an end time, then the scheduled action is automatically removed after the end time has passed. To check if an end time was selected, check the AWS CloudTrail API logs for the time when the scheduled action was configured. Check for the PutScheduledUpdateGroupAction API call in CloudTrail. If you see the API in your logs, then you must create a new scheduled action to resume scheduled scaling.
- Note that there might be a delay of a few seconds between your configured start time and the actual start time.
If the scheduled action was activated but didn't make the required changes:
- Check for suspended processes. If there are any suspended processes, then you can resume them.
- If dynamic scaling policies are configured, then check the activity history for any scaling event caused by the dynamic scaling policies. Check the history at a few minutes before and after the scheduled action's start time. If there was activity, then it might have overridden the scheduled action.
- Check the activity history around the scheduled action's start time. If there's another scheduled action configured to activate in a similar time period, then check that it doesn't impact or override your new scheduled action. Update your scheduled actions to resolve these conflicts.
- Check the activity history for any failed or canceled Launch or Terminate activities. If there are any failed or canceled activities, then expand the events to review the Description for more details. For more information, see Troubleshoot issues in Amazon EC2 Auto Scaling.
Note: Use scheduled actions to proactively scale an Auto Scaling group when you know the time frame for a one-time or recurring event. Use the predictive scaling feature when you don't know the time frame of an event in advance.
Related information
Scheduled scaling for Amazon EC2 Auto Scaling