Scaling, Pricing & Best Practices
Handle traffic spikes automatically and stop overpaying for servers.
1 min read
Scaling out with Auto Scaling + a load balancer
One server is a single point of failure. The standard production setup is:
- An Application Load Balancer (ALB) that spreads requests across instances and checks their health.
- An Auto Scaling group that keeps a set number of healthy instances running across multiple Availability Zones, adding more when CPU is high and removing them when traffic drops.
- A launch template that describes what each new instance looks like (AMI, type, user data).
- 1Users
HTTPS requests
- 2Load balancer
Spreads traffic, checks health
- 3Auto Scaling group
2–10 instances across AZs
- 4Your app
Same AMI on every instance
Pricing models
| Model | How it works | Best for |
|---|---|---|
| On-Demand | Pay per second, no commitment | Getting started, unpredictable workloads |
| Savings Plans / Reserved | Commit to 1 or 3 years of usage for a big discount | Steady, always-on workloads |
| Spot | Use spare capacity at a steep discount. AWS can reclaim it with a 2-minute warning. | Batch jobs, CI, fault-tolerant work |
Best practices
- Treat servers as cattle, not pets. Any instance should be replaceable from its launch template.
- Right-size. Check CloudWatch CPU and memory, and downsize instances that sit mostly idle.
- Patch automatically with Systems Manager Patch Manager, or by rolling out new AMIs.
- Put instances in private subnets behind a load balancer whenever possible (see the VPC tutorial).
Tip
If you find yourself managing many EC2 instances just to run containers or simple web apps, look at ECS with Fargate or Lambda, where AWS handles the servers for you.
Key takeaways
- A load balancer plus an Auto Scaling group gives you high availability and automatic scaling.
- On-Demand for flexibility, Savings Plans for steady use, Spot for interruptible work.
- Make instances replaceable and right-size them regularly.
Check your understanding
Pick an answer to see the explanation.
1. Your nightly batch job can be safely restarted if interrupted. Which pricing model saves the most?
2. What does an Auto Scaling group do?
Next in “Run a classic web app”
You finished EC2. Continue with the RDS & Aurora tutorial