Can we use two different types of AWS EC2 instances with elastic beanstalk loadbalancer

343 views Asked by At

I'm using elastic beanstalk to host my rails application, I've configured load balancer and I know how to set maximum and minimum numbers of instances of same type(for example 2 instances of T2.micro or 2 instances of T2.medium). My question is can I use two different types of instance in elastic beanstalk load balancer. e.g. one t2.Micro and one T2.Medium in same environment.

1

There are 1 answers

0
Brian On

Not strictly through ElasticBeanstalk. The concept with EB is that it's supposed to handle scaling up and down for you, based on the Auto Scaling rules that you define. When your rule says to scale up, EB will instantiate a new instance of the same type and add it to your cluster.

EB is just a layer on top of EC2, however, so I imagine it would be possible to manually add a different type of instance to the Load Balancer that EB creates for you. I don't know, however, how that would interact/conflict with Auto Scaling.

All that being said - why would you want to do this? In your example with one t2.micro and one t2.medium, obviously the medium will be able to handle more traffic. As a result, your load balancer would need know that, and allocate traffic proportionally - say 25% to the micro and 75% to the medium. That would more complicated than just allocating traffic in a balancer manner across the cluster, with no benefit that I can think of.