Elastic Beanstalk Change ELB Type
Asked Answered
M

3

36

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.

Mook answered 10/10, 2017 at 11:56 Comment(0)
G
26

Hello As Per AWS Documentation:

The Elastic Beanstalk Environment Management Console only supports creating and managing an Elastic Beanstalk environment with a Classic Load Balancer. For other options, see Application Load Balancer and Network Load Balancer.

Also

Note You can only set the load balancer type during environment creation. (Refer AWS Documetnation)

So When you deploy application to Elastic Beanstalk via AWS CLI:

Try

eb create test-env --elb-type network

or

eb create test-env --elb-type application

Gastelum answered 10/10, 2017 at 12:35 Comment(6)
Thanks, that's a shame. It means any existing environments can't be changed I'd presume then.Mook
As of now no according to official AWS documentation , do mark question solved if the answer clears your doubtsGastelum
Annoying how coy the official docs are about this in other places. You can use the EC2 load balancer migration wizard to generate a second application load balancer which forwards to the classic one, if you don't mind paying twice and it serves your purposes.Boost
Seems like this answer is no longer true. It is possible to create the Application Load Balancer through the console. I did it myself too. aws.amazon.com/about-aws/whats-new/2018/04/…Ironbound
indeed, one can now click the load balancer to configure it to any type, including shared application. It's still not possible to change it once configured though.Violative
ELB docs for EB moved to docs.aws.amazon.com/elasticbeanstalk/latest/dg/…New
N
30

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.

Naze answered 8/9, 2018 at 16:20 Comment(3)
This answer is nice, but it is not so easy to follow it to actually make the changesIronbound
This does not work anymore. editing , saving, uploading and loading the modified configuration now generates error "Unable to load configuration: Configuration validation exception: LoadBalancer type option cannot be changed." [![when I tried to do this ][1]][1] [1]: i.sstatic.net/7PgTJ.pngIconoclast
@KapilAggarwal Are you creating a new environment with the new configuration or trying to apply the new configuration to the existing one? What happens if you use eb config put [new save name] as described and not the console for loading?Naze
G
26

Hello As Per AWS Documentation:

The Elastic Beanstalk Environment Management Console only supports creating and managing an Elastic Beanstalk environment with a Classic Load Balancer. For other options, see Application Load Balancer and Network Load Balancer.

Also

Note You can only set the load balancer type during environment creation. (Refer AWS Documetnation)

So When you deploy application to Elastic Beanstalk via AWS CLI:

Try

eb create test-env --elb-type network

or

eb create test-env --elb-type application

Gastelum answered 10/10, 2017 at 12:35 Comment(6)
Thanks, that's a shame. It means any existing environments can't be changed I'd presume then.Mook
As of now no according to official AWS documentation , do mark question solved if the answer clears your doubtsGastelum
Annoying how coy the official docs are about this in other places. You can use the EC2 load balancer migration wizard to generate a second application load balancer which forwards to the classic one, if you don't mind paying twice and it serves your purposes.Boost
Seems like this answer is no longer true. It is possible to create the Application Load Balancer through the console. I did it myself too. aws.amazon.com/about-aws/whats-new/2018/04/…Ironbound
indeed, one can now click the load balancer to configure it to any type, including shared application. It's still not possible to change it once configured though.Violative
ELB docs for EB moved to docs.aws.amazon.com/elasticbeanstalk/latest/dg/…New
I
5

The easiest way I've found to change an existing application to use the application load balancer is using both the Console and CLI:

  1. In the console, save the application configuration of the original env. Note this name down. We'll use it as <saved-config-name>.
  2. Under the Application versions note the latest Version Label. We'll use it as <app-version>.
  3. From the CLI run eb create <new-environment-name> --elb-type application --cfg <saved-config-name> --version <app-version>
  4. If you had HTTPs configured in the old application, in the newly created application reconfigure it in the Console under Load Balancer-->Listeners with the proper certificate.
Ironbound answered 7/8, 2019 at 23:55 Comment(1)
It's worth noting that this in itself is not quite enough to update the complete EB environment - you will have to configure any load-balancer-related settings correctly, including eg listenes, SSL certs, security group configuration etcCirrus

© 2022 - 2024 — McMap. All rights reserved.