1. Home
  2. Training Library
  3. Networking & Content Delivery (DVA-C01)

Using ELB and Auto Scaling Together

Start course

This course provides detail on the AWS Networking and Content Delivery services relevant to the Developer - Associate exam.

Want more? Try a lab playground or do a Lab Challenge!

Learning Objectives

  • Understand the basics of APIs
  • Learn about HTTP and internet communication
  • Understand the difference between HTTP and REST
  • Understand what types of APIs API gateway can create
  • The general differences between those API types
  • How an API gateway functions at a high level
  • Give you an understanding of Amazon CloudFront and its high-level process of operation
  • Understand what an elastic load balancer is and what is used for
  • Be aware of the different load balancers available to you in AWS
  • Understand how ELBs handle different types of requests, including those that are encrypted
  • Be able to identify the different components of ELBs
  • Know how to configure ELBs 
  • Know when and why you might need to configure an SSL/TLS certificate



Hello and welcome to this short lecture where I shall discuss the relationship of ELBs and EC2 auto scaling. As you saw in the demonstration on the previous lecture, it's easy to associate your EC2 auto scaling group to an elastic load balancer and this is because the two services go hand in hand to provide optimal efficiency for both the performance and cost perspective. Each service by itself provides a great way to solve particular operational hurdles. The ELB allows you to dynamically manage loads across your resources based upon target groups and rules whereas EC2 auto scaling allows you to elastically scale those target groups based upon the demand put upon your infrastructure. However, one without the other can cause an operational burden. 

For example, let's say you have an ELB configured but without any auto scaling. You will need to ensure that you manually add and remove targets based upon the demand. You will need to monitor this demand allowing you to manually add or remove instances as required. Now let's look at the reverse. Let's assume you have EC2 auto scaling configured but no elastic load balancer. How are you going to evenly distribute traffic to your EC2 fleet? 

Hopefully, you can see the benefit of combining an ELB and auto scaling to help manage and automatically scale your EC2 compute resources both in and out. When you attach an ELB to an auto scaling group, the ELB will automatically detect the instances and start to distribute all traffic to the resources in the auto scaling group. When you want to associate an application load balancer or network load balancer, you associate the auto scaling group with the ELB target group. When you attach a classic load balancer, the EC2 fleet will be registered directly with the load balancer. 

Let me now provide another demonstration on how to associate your ELBs with an auto scaling group. 

Okay, so to attach an existing load balancer to your auto scaling group is very quick and simple. So firstly we go to our EC2 dashboard under Compute. We then go down to our Auto Scaling Groups at the very bottom on the left-hand side. We can see here our auto scaling group that we created in a previous demonstration. Now you'll notice on the Details section at the bottom here there's a section for classic load balancers and target groups and both of these are empty fields. So let's look at how you would associate either a classic load balancer or your target group. So once our auto scaling group is selected, we go to up to Actions and then Edit. Now if we scroll down, we get to the section here Classic Load Balancers and Target Groups. Now if we want to add a classic load balancer, then you can select here and select any classic load balancers that you have configured so I can select that one for example or if you're using an application load balancer or network load balancer, then you associate it with the target groups because the target groups are the pool of resources that the application load balancer or network load balancer are associated to. Now here we have two target groups that we created in a previous demonstration either DNS or WebServers. So we could select WebServers as our target group and simply click on Save. 

And as you can see now, this entry here for target groups, the auto scaling group is now associated to the WebServers target group. And it's as simple as that. So all you need to do to associate an existing load balancer to your auto scaling group is to edit the auto scaling group and if it's a classic load balancer, add in the classic load balancer or if it's an application load balancer or network load balancer, then you associate it to the relevant target group. And that's it. 

That now brings me to the end of this lecture. Coming up next, I will provide a summary of the key points made throughout this course.

About the Author
Will Meadows
Senior Content Developer

William Meadows is a passionately curious human currently living in the Bay Area in California. His career has included working with lasers, teaching teenagers how to code, and creating classes about cloud technology that are taught all over the world. His dedication to completing goals and helping others is what brings meaning to his life. In his free time, he enjoys reading Reddit, playing video games, and writing books.