📖 Scenario: You manage a web application hosted on AWS. To save costs during low traffic hours, you want to automatically reduce the number of servers running at night and increase them during the day.This is called scheduled scaling, where you set rules to change the number of servers at specific times.
🎯 Goal: Create an AWS Auto Scaling Group with a scheduled scaling policy that sets the desired capacity to 2 instances at 8 AM and scales down to 1 instance at 8 PM daily.
📋 What You'll Learn
Create an Auto Scaling Group named MyAppASG with a launch configuration named MyAppLaunchConfig.
Define a scheduled action named ScaleUpMorning to set desired capacity to 2 at 8 AM UTC daily.
Define a scheduled action named ScaleDownEvening to set desired capacity to 1 at 8 PM UTC daily.
💡 Why This Matters
🌍 Real World
Many companies use scheduled scaling to save money by running fewer servers during low traffic times, like nights or weekends.
💼 Career
Understanding scheduled scaling is important for cloud engineers and DevOps professionals to optimize cloud infrastructure costs and performance.
Progress0 / 4 steps
1
Create Launch Configuration
Create a launch configuration named MyAppLaunchConfig with the AMI ID ami-0abcdef1234567890 and instance type t2.micro.
AWS
Hint
The launch configuration defines the server image and size for your Auto Scaling Group.
2
Create Auto Scaling Group
Create an Auto Scaling Group named MyAppASG using the launch configuration MyAppLaunchConfig. Set the minimum size to 1, maximum size to 3, and desired capacity to 1. Use the availability zone us-east-1a.
AWS
Hint
The Auto Scaling Group manages the number of instances running based on your settings.
3
Add Scheduled Scaling Action to Scale Up
Add a scheduled action named ScaleUpMorning to the Auto Scaling Group MyAppASG that sets the desired capacity to 2 at 8 AM UTC daily. Use the cron expression 0 8 * * *.
AWS
Hint
Scheduled actions use cron expressions to run at specific times.
4
Add Scheduled Scaling Action to Scale Down
Add a scheduled action named ScaleDownEvening to the Auto Scaling Group MyAppASG that sets the desired capacity to 1 at 8 PM UTC daily. Use the cron expression 0 20 * * *.
AWS
Hint
This scheduled action reduces the number of instances at night to save costs.
Practice
(1/5)
1. What is the main purpose of scheduled scaling in AWS?
easy
A. To automatically adjust resources at specific times
B. To manually increase server capacity when needed
C. To monitor security threats in real-time
D. To backup data at scheduled intervals
Solution
Step 1: Understand scheduled scaling concept
Scheduled scaling is designed to change resource capacity automatically based on a set schedule.
Step 2: Compare options with the concept
Only To automatically adjust resources at specific times describes automatic adjustment at specific times, matching scheduled scaling.
Final Answer:
To automatically adjust resources at specific times -> Option A
C. The scaling action will be ignored due to missing EndTime
D. The resource capacity will remain unchanged
Solution
Step 1: Understand the scheduled action parameters
The action named "ScaleUpMorning" is set to start at 8 AM UTC on July 1, 2024, with DesiredCapacity 5.
Step 2: Interpret the effect of StartTime and DesiredCapacity
At the StartTime, the capacity will be set to 5. EndTime is optional and does not block the action.
Final Answer:
The resource capacity will be set to 5 -> Option A
Quick Check:
StartTime triggers capacity change to DesiredCapacity [OK]
Hint: StartTime sets capacity; EndTime is optional [OK]
Common Mistakes:
Thinking EndTime is required to trigger scaling
Assuming capacity decreases without explicit setting
Ignoring the StartTime effect
4. You created a scheduled scaling action with this cron expression: cron(0 25 * * ? *) Why does the scaling not trigger as expected?
medium
A. The day-of-week field is missing
B. The minute value 0 is invalid
C. The hour value 25 is invalid in cron expressions
D. The cron expression needs only 5 fields
Solution
Step 1: Check the hour field in the cron expression
The hour field is set to 25, but valid hour values are 0 to 23.
Step 2: Understand cron validation rules in AWS
AWS rejects cron expressions with invalid field values, so the scaling action won't trigger.
Final Answer:
The hour value 25 is invalid in cron expressions -> Option C
Quick Check:
Hour must be 0-23 in AWS cron [OK]
Hint: Check cron field ranges; hours max 23 [OK]
Common Mistakes:
Assuming minute 0 is invalid
Thinking day-of-week is mandatory
Using 5 fields instead of 6
5. You want to reduce your AWS Auto Scaling group capacity to 2 instances every night at 11 PM UTC and increase it to 10 instances every weekday morning at 7 AM UTC. Which setup correctly uses scheduled scaling to achieve this?
hard
A. Create one scheduled action with cron(0 23,7 * * ? *) setting DesiredCapacity=2 and DesiredCapacity=10
B. Create two scheduled actions: one with cron(0 23 * * ? *) setting DesiredCapacity=2, another with cron(0 7 ? * MON-FRI *) setting DesiredCapacity=10
C. Create two scheduled actions: one with rate(1 day) setting DesiredCapacity=2, another with rate(1 hour) setting DesiredCapacity=10
D. Create one scheduled action with cron(0 7 * * ? *) setting DesiredCapacity=10 only
Solution
Step 1: Understand the scheduling requirements
Capacity should be 2 at 11 PM daily and 10 at 7 AM on weekdays only.
Step 2: Match cron expressions to requirements
cron(0 23 * * ? *) runs daily at 11 PM; cron(0 7 ? * MON-FRI *) runs at 7 AM Monday to Friday. Two separate scheduled actions are needed with correct DesiredCapacity values.
Final Answer:
Create two scheduled actions: one with cron(0 23 * * ? *) setting DesiredCapacity=2, another with cron(0 7 ? * MON-FRI *) setting DesiredCapacity=10 -> Option B
Quick Check:
Separate cron for each time and capacity [OK]
Hint: Use separate scheduled actions with correct cron and capacity [OK]
Common Mistakes:
Trying to set two capacities in one scheduled action
Using rate expressions instead of cron for weekdays
Missing weekday restriction for morning scale-up
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.