65
votes

I would like to switch off Elastic Load Balancer (ELB) for my Elastic Beanstalk environment.

Currently I don't need it and I don't want to pay for it.

It is possible to delete the ELB in EC2 managment window but then Elastic Beanstalk health state is switched from GREEN to RED. I just found a information that it's not possible.

Does someone has a trick how to run Elastic Beanstalk without load balancing and have environment GREEN health state?

4
I'm afraid you cannot remove the load balancer from Elastic Beanstalk since its part of the package. You can do something else which may require a bit more configuration - you can create a CloudFormation script that uses a predefined AMI (probably something similar to what Beanstalk uses) and do all the deployment on your own.Eran Sandler
I believe you can grab the Elastic IP associated with your load balancer from the EC2 management page, and associate it directly with your app server instance. I expect the preconfigured health monitoring would still fall over, though - so more changes would be needed to get everything "green" again.rvalue
Do you not want to pay for the entire EB application or just the load balancer? There is a way to sustain your EB without any instances or a load balancer (so it's temporarily suspended for free), and you can still turn it back on fairly quickly later on.ecoe

4 Answers

62
votes

Since July 2013 Elastic Beanstalk supports "single-instance" environments that have a single container instance running without a load balancer. Existing environments that are set up using "load balancing environment" can be switched to "single instance" and vice versa.

Prior to this it was not possible to remove the load balancer and have Elastic Beanstalk still work correctly. The load balancer is an integral part of the way that Elastic Beanstalk works in "load-balancing environment" configurations.

36
votes

In the new Elastic Beanstalk interface I noticed the option to create my environment as a single instance.

Dropdown with options "Single instance" and "Load balancing, autoscaling".

I tried it out and, as one might expect, it didn't create an Elastic Load Balancer. Hooray!

The options are described in the AWS EB documentation. At first I recreated the environments I don't need to balance automatically, but apparently you can even switch environment type on the fly.

10
votes

From command line you can do it like this

eb create -s

Note When activating the single instance mode (-s switch) neither the load balancer nor the auto scaling group is created

An alternative approach is to create a worker environment either through the console

enter image description here

or through CLI

eb create -t Worker
6
votes

In a saved configuration, or module-specific env.yaml, use this :

OptionSettings: aws:elasticbeanstalk:environment: EnvironmentType: SingleInstance

To create a single-instance EB environment.