0
0
AWScloud~5 mins

Predictive scaling overview in AWS - Commands & Configuration

Choose your learning style9 modes available
Introduction
Predictive scaling helps your cloud servers prepare for future traffic by learning from past patterns. It automatically adjusts the number of servers before demand changes, so your app stays fast and reliable without wasting resources.
When your website traffic grows and shrinks in a regular daily or weekly pattern.
When you want to avoid slowdowns during expected busy times like sales or events.
When you want to save money by not running too many servers during quiet periods.
When manual scaling is too slow or error-prone for your app's needs.
When you want your cloud to adjust automatically based on learned trends.
Commands
This command schedules a predictive scaling action for the Auto Scaling group named 'my-app-asg'. It sets the minimum, maximum, and desired number of servers based on expected traffic patterns for the first week of June, recurring daily at midnight.
Terminal
aws autoscaling put-scheduled-update-group-action --auto-scaling-group-name my-app-asg --scheduled-action-name predictive-scaling --start-time 2024-06-01T00:00:00Z --end-time 2024-06-07T23:59:59Z --recurrence "0 0 * * *" --min-size 2 --max-size 10 --desired-capacity 5
Expected OutputExpected
No output (command runs silently)
--auto-scaling-group-name - Specifies the name of the Auto Scaling group to apply predictive scaling.
--scheduled-action-name - Names the scheduled scaling action for easy identification.
--recurrence - Defines how often the scaling action repeats using cron syntax.
This command checks the scheduled scaling actions for the Auto Scaling group to confirm that the predictive scaling schedule is set correctly.
Terminal
aws autoscaling describe-scheduled-actions --auto-scaling-group-name my-app-asg
Expected OutputExpected
ScheduledUpdateGroupActions: - AutoScalingGroupName: my-app-asg ScheduledActionName: predictive-scaling StartTime: 2024-06-01T00:00:00Z EndTime: 2024-06-07T23:59:59Z Recurrence: 0 0 * * * MinSize: 2 MaxSize: 10 DesiredCapacity: 5
--auto-scaling-group-name - Filters the scheduled actions for the specified Auto Scaling group.
Key Concept

If you remember nothing else from this pattern, remember: predictive scaling uses past traffic patterns to automatically adjust your server count ahead of time, keeping your app ready and cost-efficient.

Common Mistakes
Setting the min-size and max-size too close together.
This limits the flexibility of scaling and can cause performance issues during unexpected traffic spikes.
Set a reasonable range between min-size and max-size to allow scaling to adjust smoothly.
Not verifying the scheduled actions after creation.
You might think predictive scaling is active when it is not, leading to no automatic scaling.
Always run describe-scheduled-actions to confirm your scaling schedule is correctly applied.
Summary
Use 'aws autoscaling put-scheduled-update-group-action' to create predictive scaling schedules.
Check your schedules with 'aws autoscaling describe-scheduled-actions' to ensure they are active.
Set appropriate min, max, and desired server counts to allow smooth scaling based on predicted traffic.