Study guide
Technical reference and lesson notes
Purpose of This Lesson
Applications running on Amazon EC2 must handle changing demand while maintaining availability. Two AWS capabilities address the core requirements:
- Auto Scaling adjusts the number of EC2 instances available to serve application demand.
- Elastic Load Balancing (ELB) distributes incoming connections across available application instances.
Used together, they create an application tier that can expand, contract, and continue serving traffic when capacity or individual instances change.
Key Concepts
Auto Scaling provides the right amount of capacity
An Auto Scaling Group manages a pool of EC2 instances. Its purpose is to maintain sufficient compute capacity for the application rather than relying on a fixed number of manually managed instances.
As demand changes, the group can increase or decrease the number of instances. This supports:
- Elasticity: capacity can respond to changing workload levels.
- Operational efficiency: instances do not need to be added or removed manually for every demand change.
- Application availability: the group can maintain multiple instances instead of depending on a single server.
Elastic Load Balancing distributes connections
Elastic Load Balancing sits in front of the application instances and distributes incoming connections across the available pool of EC2 instances.
This creates an access point for clients while keeping the backend instance fleet interchangeable from the client’s perspective. As instances are added or removed by Auto Scaling, the load balancer can direct traffic to the current set of available instances.
The services solve different problems
Auto Scaling and ELB are complementary, but they are not interchangeable:
| Capability | Primary responsibility |
|---|---|
| Auto Scaling Group | Maintains an appropriate number of EC2 instances |
| Elastic Load Balancing | Distributes incoming connections across instances |
| Combined architecture | Provides an elastic and more fault-tolerant application tier |
A load balancer alone does not automatically create more EC2 capacity. Auto Scaling alone does not provide a traffic-distribution layer for clients.
Architecture Decision Guide
| Requirement | Relevant capability | Design implication |
|---|---|---|
| Application demand varies over time | Auto Scaling | Adjust the number of EC2 instances to match demand |
| Traffic must be distributed across multiple instances | Elastic Load Balancing | Place the load balancer in front of the instance fleet |
| Instances may be added or removed dynamically | Auto Scaling + ELB | Ensure traffic is directed to the currently available instances |
| Avoid dependence on one EC2 instance | Auto Scaling + ELB | Use a managed pool of instances behind a shared entry point |
| Build an elastic and fault-tolerant application tier | Auto Scaling + ELB | Combine capacity management with connection distribution |
Exam-Relevant Takeaways
- Auto Scaling manages capacity; ELB manages traffic distribution.
- An Auto Scaling Group maintains a pool of EC2 instances for an application.
- Elastic Load Balancing distributes incoming connections across the instance pool.
- The load balancer should be considered the client-facing entry point, with the EC2 fleet behind it.
- The two services address separate parts of the scalability problem and are commonly deployed together.
- Adding a load balancer does not, by itself, scale the number of backend instances.
- Adding Auto Scaling does not, by itself, distribute client connections across the fleet.
Common Exam Traps
- Confusing elasticity with load balancing: elasticity is the ability to adjust capacity; load balancing is the distribution of traffic.
- Assuming ELB launches instances: ELB routes connections but does not determine the required EC2 fleet size.
- Assuming Auto Scaling distributes traffic: an Auto Scaling Group manages instances; it is not the application’s traffic-distribution layer.
- Treating the services as alternatives: in a typical EC2 application architecture, ELB and Auto Scaling work together rather than replacing one another.
- Designing around a single EC2 instance: a single instance creates a capacity and availability dependency that the combined pattern is intended to avoid.
Real-World Engineer Notes
Keep the responsibilities clear when designing or troubleshooting the architecture:
- If requests are not reaching healthy backend instances, investigate the load-balancing path and instance availability.
- If the application cannot handle increased demand because there are too few instances, investigate Auto Scaling capacity management.
- When instances are replaced or the fleet size changes, the traffic-distribution layer must continue serving the currently available instances.
- The combined pattern is most useful when the application can run across multiple interchangeable EC2 instances. Stateful designs may require additional architecture for session and data management.
Quick Reference Summary
- EC2: provides the compute instances.
- Auto Scaling Group: maintains the desired application capacity.
- Elastic Load Balancing: distributes incoming connections across the instance fleet.
- Recommended pattern: clients → ELB → Auto Scaling-managed EC2 instances.
- Main benefit: an elastic, more fault-tolerant application tier.
Flashcards
1. What problem does Auto Scaling solve?
It helps maintain the appropriate number of EC2 instances to service application demand.
2. What problem does Elastic Load Balancing solve?
It distributes incoming connections across a pool of backend instances.
3. Where is ELB positioned in this architecture?
ELB is placed in front of the EC2 instances and acts as the traffic-distribution layer.
4. What resource does an Auto Scaling Group manage in this lesson?
A pool of EC2 instances used to run the application.
5. Does ELB automatically increase the number of EC2 instances?
No. ELB distributes traffic; Auto Scaling manages the number of instances.
6. Does an Auto Scaling Group distribute incoming connections?
No. The group manages instance capacity. Elastic Load Balancing distributes connections.
7. Why combine Auto Scaling and ELB?
Together they provide both capacity elasticity and traffic distribution, supporting a more fault-tolerant application tier.
8. What is the client-facing entry point in the common pattern?
The Elastic Load Balancer, with the Auto Scaling-managed EC2 instances behind it.
9. What happens when application demand changes?
Auto Scaling can adjust the number of EC2 instances, while ELB distributes traffic across the available pool.
10. What architectural risk does this pattern reduce?
It reduces dependence on a single EC2 instance for application capacity and traffic handling.
Practice Questions
Question 1
An application runs on several EC2 instances. During periods of high demand, additional instances must be available automatically, and client connections must be distributed across the current fleet. Which design best meets both requirements?
A. Use Elastic Load Balancing only
B. Use an Auto Scaling Group only
C. Use an Auto Scaling Group behind Elastic Load Balancing
D. Use a larger single EC2 instance
Correct answer: C
Explanation: Auto Scaling adjusts the number of EC2 instances, while Elastic Load Balancing distributes incoming connections across them. The two services address complementary requirements.
Question 2
A solutions architect places an Elastic Load Balancer in front of an EC2 application but does not configure Auto Scaling. What capability is missing?
A. The ability to distribute incoming connections
B. The ability to automatically adjust the number of EC2 instances
C. The ability to accept client connections
D. The ability to run an application on EC2
Correct answer: B
Explanation: ELB provides connection distribution, but automatic capacity adjustment requires an Auto Scaling Group.
Question 3
An Auto Scaling Group has launched several EC2 instances, but the architect needs a single application endpoint that distributes client connections across those instances. Which service should be added?
A. Elastic Load Balancing
B. Another Auto Scaling Group
C. A larger EC2 instance
D. Manual instance replacement
Correct answer: A
Explanation: Elastic Load Balancing provides the shared entry point and distributes incoming connections across the instance pool.
Question 4
Which statement accurately describes the relationship between Auto Scaling and Elastic Load Balancing?
A. Auto Scaling distributes connections, while ELB changes instance count.
B. ELB replaces the need for multiple EC2 instances.
C. Auto Scaling manages capacity, while ELB distributes traffic.
D. Both services perform exactly the same function.
Correct answer: C
Explanation: Auto Scaling is responsible for maintaining application capacity. ELB is responsible for distributing incoming connections across available instances.
Question 5
A company wants an EC2-based application tier that can respond to changing demand and avoid relying on a single backend server. Which architectural benefit is provided by combining Auto Scaling and ELB?
A. Elastic and fault-tolerant application capacity
B. Elimination of all application-level state
C. Automatic conversion of EC2 workloads to serverless workloads
D. Guaranteed zero application errors
Correct answer: A
Explanation: Auto Scaling provides adjustable capacity, and ELB distributes traffic across the instance fleet. Together they support an elastic and more fault-tolerant application tier.