Scheduled scaling: Scale Spot Fleet on a schedule
Scaling your fleet on a schedule enables you to scale your application in response to predictable changes in demand. By creating scheduled actions, you can instruct Spot Fleet to perform scaling activities at specific times. To create a scheduled action, you must specify an existing Spot Fleet, the time when the scaling activity must occur, and the desired minimum and maximum capacity. Scheduled actions can be configured to scale once or on a recurring schedule. If you needs change, you can edit or delete scheduled actions.
Prerequisites
-
Sheduled actions can only be created for existing Spot Fleets. You can't create a scheduled action when you create a Spot Fleet.
-
The Spot Fleet request must have a request type of
maintain
. Automatic scaling is not supported for requests of typerequest
. -
Configure the IAM permissions required for Spot Fleet automatic scaling.
-
Review the Considerations.
To create a one-time scheduled action
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the navigation pane, choose Spot Requests.
-
Select your Spot Fleet request.
-
Choose the Scheduled Scaling tab near the bottom of the screen. If you selected the link for your Spot Fleet, there is no tab; instead, scroll down to the Scheduled Scaling section.
-
Choose Create scheduled action.
-
For Name, specify a name for the scheduled action.
-
Enter a value for Minimum capacity, Maximum capacity, or both.
-
For Recurrence, choose Once.
-
(Optional) Choose a date and time for Start time, End time, or both.
-
Choose Create.
To create a recurring scheduled action
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the navigation pane, choose Spot Requests.
-
Select your Spot Fleet request.
-
Choose the Scheduled Scaling tab near the bottom of the screen. If you selected the link for your Spot Fleet, there is no tab; instead, scroll down to the Scheduled Scaling section.
-
For Name, specify a name for the scheduled action.
-
Enter a value for Minimum capacity, Maximum capacity, or both.
-
For Recurrence, choose one of the predefined schedules (for example, Every day), or choose Custom and enter a cron expression. For more information about the cron expressions supported by scheduled scaling, see Cron expressions in the Amazon EventBridge User Guide.
-
(Optional) Choose a date and time for Start time, End time, or both.
-
Choose Submit.
To edit a scheduled action
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the navigation pane, choose Spot Requests.
-
Select your Spot Fleet request.
-
Choose the Scheduled Scaling tab near the bottom of the screen. If you selected the link for your Spot Fleet, there is no tab; instead, scroll down to the Scheduled Scaling section.
-
Select the scheduled action and choose Actions, Edit.
-
Make the needed changes and choose Submit.
To delete a scheduled action
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
. -
In the navigation pane, choose Spot Requests.
-
Select your Spot Fleet request.
-
Choose the Scheduled Scaling tab near the bottom of the screen. If you selected the link for your Spot Fleet, there is no tab; instead, scroll down to the Scheduled Scaling section.
-
Select the scheduled action and choose Actions, Delete.
-
When prompted for confirmation, choose Delete.
To manage scheduled scaling using the AWS CLI
Use the following commands: