AWS Elastic Beanstalk environment with multiple Load Balancers

rafaismyname picture rafaismyname · Jan 21, 2014 · Viewed 7.1k times · Source

I have the following situation: I have 1 Rails App that has 2 domains, each of these domains has multiple/dynamical subdomains. This app is in AWS using a load-balanced Elastic Beanstalk.

What i need is that those 2 domains that points to my single Rails App to work under SSL in port 443.

But since Elastic Beanstalk has only one load balancer, I can only use one single SSL certificate on port 433 :( Using a UCC SSL certificate won't be the solution because i need each domain certificate to be wildcard, so the dynamic subdomains will also work.

Any thoughts about how to get multiple Load Balancers playing nicely with an Elastic Beanstalk Environment?

Best.

Answer

madmuffin picture madmuffin · Dec 22, 2015

To add multiple Elastic Load Balancers (ELB) to an Elastic Beanstalk (EB) application, you need to add the additional ELB to the auto scaling group of the EB app.

On the command line

The easiest way to achieve this is through the AWS CLI (https://aws.amazon.com/cli/):

aws autoscaling attach-load-balancers --auto-scaling-group-name <SG_NAME> --load-balancer-names <ELB_NAME>

In the AWS Console

Of course this can be done in the AWS Console, too:

  1. Go to EC2 > Auto Scaling > Auto Scaling Groups
  2. select the group you want to add the elb to
  3. Select the Details Tab
  4. Edit-Button on the top right
  5. Use the Autocompletion in the Load Balancers field to add your load balancer
  6. Save

For your convenience, you can see where you need to click for all of the 5 steps (don't forget to save!) clickpath_image

For me this works also on eb-generated auto scaling groups (Region: eu-central-1).

This might not have been available at the time of the question, but it is now.