Scaling based on a schedule allows you to scale your application in response to 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 activities based on the predictable traffic patterns of your web application.
To configure your Auto Scaling group to scale based on a schedule, you create a scheduled action, which 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.
Edit asg-scheduled-scaling.json and replace %StartTime% with a UTC timestamp of a few minutes in the future. For example: 2018-11-11T12:20:00. You can use this site to help. Look for the Atom format. Save the file.
Schedule the scaling action:
aws autoscaling put-scheduled-update-group-action --cli-input-json file://asg-scheduled-scaling.json
This command will not return any output if it is successful.
Browse to the Auto Scaling console and check out your newly created scheduled scaling action in the Scheduled Actions tab. Wait for the time you chose, and take a look at the instances it has deployed by checking the Activity History tab and the Instances tab.
Browse to the AWS CodeDeploy console, make sure your region is selected in the upper right-hand corner dropdown, and notice that CodeDeploy will automatically deploy the application to new instances launched by the auto scaling group.
The CodeDeploy console will not default to your current region. Please make sure to click on Select a Region in the upper right-hand corner and select your region in the dropdown.