Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does it make sense to have an Amazon Elastic Load Balancer with just one EC2 instance?

my question is simple. Does it make sense to have an Amazon Elastic Load Balancer (ELB) with just one EC2 instance?

If I understood right, ELB will switch traffic between EC2 instances. However, I have just one EC2 instance. So, does it make sense?

On the other hand, I´m using Route 53 to route my domain requests example.com, and www.example.com to my ELB, and I don´t see how to redirect directly to my EC2 instance. So, do I need an ELB for routing purposes?

like image 564
Rober Avatar asked Dec 06 '14 21:12

Rober


People also ask

Do I need a load balancer for EC2?

If your application is built within the Amazon Elastic Compute Cloud (Amazon EC2) Classic network, you should use Classic Load Balancer. If you need to deploy and run third-party virtual appliances, you can use Gateway Load Balancer.

Can we use multiple ELB for single EC2 machine?

I discovered an interesting feature of Amazon EC2 Elastic Load Balancing today: you can add an EC2 instance to more than one ELB virtual appliance.

What is a primary reason why you should be using an elastic load balancer?

Elastic Load Balancing automatically distributes your incoming traffic across multiple targets, such as EC2 instances, containers, and IP addresses, in one or more Availability Zones. It monitors the health of its registered targets, and routes traffic only to the healthy targets.

Can elastic load balancing be enabled only in a single availability Zone?

We recommend enabling multiple Availability Zones for all load balancers. With an Application Load Balancer however, it is a requirement that you enable at least two or more Availability Zones. This configuration helps ensure that the load balancer can continue to route traffic.


2 Answers

Using an Elastic Load Balancer with a single instance can be useful. It can provide your instance with a front-end to cover for a disaster situation.

For example, if you use an auto-scaling group with min=max=1 instance, with an Elastic Load Balancer, then if your instance is terminated or otherwise fails:

  1. auto-scaling will launch a new replacement instance
  2. the new instance will appear behind the load balancer
  3. your user's traffic will flow to the new instance

This will happen automatically: no need to change DNS, no need to manually re-assign an Elastic IP address.

Later on, if you need to add more horsepower to your application, you can simply increase your min/max values in your autoscaling group without needing to change your DNS structure.

like image 133
Matt Houser Avatar answered Sep 20 '22 21:09

Matt Houser


It's much easier to configure your SSL on an ELB than an EC2, just a few clicks in the AWS console. You can even hand pick the SSL protocols and ciphers.

It's also useful that you can associate different security groups to the actual EC2 and the forefront ELB. You can leave the ELB in the DMZ and protect your EC2 from being accessible by public and potentially vulnerable to attacks.

like image 35
Hesky Avatar answered Sep 19 '22 21:09

Hesky