Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elastic Beanstalk Change ELB Type

Does anyone know if it's possible to change an existing AWS Elastic Beanstalk environment to an Application Load Balancer (instead of a classic one).

As far as I know only Application ELB's can be protected with AWS WAF and DDOS "Shield" so any existing EB app can't take advantage of these features since they have classic ELB's.

like image 699
David Avatar asked Oct 10 '17 11:10

David


People also ask

What load balancer does Elastic Beanstalk use?

A load balancer distributes traffic among your environment's instances. When you enable load balancing, AWS Elastic Beanstalk creates an Elastic Load Balancing load balancer dedicated to your environment.

How do you remove the load balancer from Elastic Beanstalk?

To delete a load balancer using the consoleOpen the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . On the navigation pane, under LOAD BALANCING, choose Load Balancers. Select the load balancer, and then choose Actions, Delete. When prompted for confirmation, choose Yes, Delete.

How do I change the port on my Elastic Beanstalk?

By default, Elastic Beanstalk configures the proxy to forward requests to your application on port 5000. You can override the default port by setting the PORT environment property to the port that your main application listens on.


1 Answers

It is not possible to change the load balancer type for an existing environment but I have used the following process to create a cloned environment with an application load balancer (instead of classic).

  1. In the console, save configuration of the original env.
  2. In terminal, eb config get [save name], you will get a file in .elasticbeanstalk\saved_configs .
  3. Edit the file to add

OptionSettings: aws:elasticbeanstalk:environment: LoadBalancerType: application

and remove (if you have those):

aws:elb:loadbalancer: CrossZone: true aws:elb:policies: ConnectionDrainingEnabled: true aws:elb:listener:443: [whatever]

You can use this opportunity to do other changes, such as upgrade PlatformArn

  1. Save modified config as [new save name].
  2. In terminal, eb config put [new save name] .
  3. Update your .ebextensions to have LoadBalancerType: application and optionally add listener to elbv2. You can also create in the console manually later.

aws:elbv2:listener:443: ListenerEnabled: true SSLPolicy: ELBSecurityPolicy-TLS-1-2-2017-01 SSLCertificateArns: [your cert id] DefaultProcess: default Protocol: HTTPS Rules: ''

  1. Create a new env with eb create [new env name] --cfg [new save name]

Now you will have a new environment with a different load balancer type side-by-side with your old environment. You can perform testing, make further configuration changes and then if all is well, swap CNAMEs and terminate the previous environment.

like image 141
Arik Yavilevich Avatar answered Sep 24 '22 18:09

Arik Yavilevich