Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

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, and 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?

1 Answer

0 votes
by (44.4k points)

You can do both, use it or not use it. First, let me tell you about it without load balancing:

To point your domain name to an EC2 instance:

  • In the EC2 Management Console, select Elastic IP
  • Allocate New Address
  • Associate the address with your EC2 instance
  • Copy the Elastic IP address and use it in your Route 53 sub-domain

The Elastic IP address will be re-associated with a different EC2 instance later if desired.

Later, if you would like to balance between multiple EC2 instances:

  • Create an Elastic Load Balancer
  • Add your instances to the Load Balancer
  • Point your Route 53 sub-domain to the Load Balancer

Now, for a single instance why would you need an ELB. What if your current instance crashes and you want another instance up and running in no time. Then you will need an ELB and you can mention the minimum and maximum instance as 1 so you don’t launch multiple instances.

So, if your instance fails:

  • Auto-scaling will terminate the old instance and launch a new one.
  • The created instance will appear behind the load balancer
  • The user’s traffic will automatically divert to the new instance.

There is no need to change the public DNS or assign Elastic IPs.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

Browse Categories