DEV Community

Biagio J Mendolia
Biagio J Mendolia

Posted on

Elastic Load Balancing & Auto Scaling Groups in AWS EC2

This week I learned about Elastic Load Balancing (ELB) and Auto Scaling Groups (ASG). Learning these features of EC2 was very interesting because it started to show some of the main advantages of the AWS cloud! I think it will help if I start with by defining some key terms for this section.

Scalability - The ability to accommodate a larger load by upgrading hardware (scaling up), or by adding more hardware (scaling out).

Elasticity - When a system can auto scale based on load.

Now that we’ve covered that, let's jump into ELB! Load balancers are servers that forward internet traffic to multiple servers, or in our case EC2 instances, downstream. This helps to seamlessly handle the failure of downstream instances! Now an ELB is a managed AWS load balancer that takes care of upgrades and maintenance automatically! AWS offers 2 types of load balancers:

  • Layer 7: an application load balancer designed for HTTP/ HTTPS only.
  • Layer 4: a network load balancer (ultra-high performance, allows for TCP)

Basically, the load balancer is exposed to the public via domain. The load balancer detects incoming traffic to the domain and distributes the traffic to different EC2 instances to help deal with traffic in an efficient way.

To help deal with the change of the load that applications face, Auto Scaling groups were created. The goal of an ASG is to:

  • Add EC2 instances to match increase load.
  • Remove EC2 instances to match decrease load.
  • Ensure there is a minimum and maximum number of machines running.
  • Automatically register new instances to a load balancer.
  • Replace unhealthy instances.
  • Only run at an optimal capacity to save cost.

Basically, when setting up an ASG, you set a minimum, maximum and desired capacity of EC2 instances. This then allows the ASG to scale in and out, based on how much load it receives, allowing the application to consistently run at optimal performance.

That wraps up ELB and ASG in AWS! Next week I'll be covering Amazon S3 the “infinitely scaling” storage of AWS. Thanks for stopping by!

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay