Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Elastic Beanstalk environment with multiple Load Balancers

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.

like image 247
rafaismyname Avatar asked Jan 21 '14 19:01

rafaismyname


People also ask

How does load balancing work in AWS Elastic Beanstalk?

When you enable load balancing, AWS Elastic Beanstalk creates an Elastic Load Balancing load balancer for your environment. The load balancer distributes traffic among your environment's instances. Elastic Beanstalk supports these load balancer types: Classic Load Balancer – The Elastic Load Balancing previous-generation load balancer.

How does the application load balancer work with Beanstalk?

When you create a load-balanced, scaling environment and choose to use an Application Load Balancer, Elastic Beanstalk creates a load balancer dedicated to your environment by default.

How does Elastic Beanstalk work?

Elastic Beanstalk treats rule priority settings as relative across environments sharing the load balancer, and maps them to absolute priorities during creation. Elastic Beanstalk creates a default security group and attaches it to the load balancer. You can configure one or more security groups to use for the load balancer.

What is the difference between AWS listenerrule and elasticbeanstalk?

aws:elbv2:listenerrule – Configure rules that route traffic to different processes, depending on the request path. Rules are unique to Application Load Balancers. aws:elasticbeanstalk:environment:process – Configure health checks and specify the port and protocol for the processes that run on your environment's instances.


1 Answers

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.

like image 90
madmuffin Avatar answered Oct 02 '22 12:10

madmuffin