I wanted to know if there is an option to STOP Amazon Elastic Beanstalk as an atomic unit as I can do with EC2 servers instead of going through each service (e.g. load balancer, EC2..) and STOP (and START) them independently?
-
Seems like this question should be on http://serverfault.com/ – nu everest Sep 29 '16 at 18:05
-
This looks like a duplicate of https://stackoverflow.com/questions/32210389/pause-an-elastic-beanstalk-app-environment/69058848#69058848 – bwobbones Sep 06 '21 at 19:28
3 Answers
The EB command line interface has an eb stop
command. Here is a little bit about what the command actually does:
The eb stop command deletes the AWS resources that are running your application (such as the ELB and the EC2 instances). It however leaves behind all of the application versions and configuration settings that you had deployed, so you can quickly get started again. Eb stop is ideal when you are developing and testing your application and don’t need the AWS resources running over night. You can get going again by simply running eb start.
EDIT:
As stated in the below comment, this is no longer a command in the new eb-cli
.

- 2,082
- 16
- 29
-
1
-
1I don't think so. I don't currently have an EB environment running, so I can't tell you for sure. If I find information to suggest otherwise I'll update my answer. – EFeit Dec 05 '13 at 15:29
-
22this is no longer a command in the new `eb-cli`. there is only a "Terminate Environment" (`eb terminate`) that is available in both `eb-cli` and web console. – skilleo Jan 06 '15 at 18:38
-
2Note that you can still re-deploy a terminated environment. When creating a new environment, on the Application Version step choose the application version you previously terminated. – Daniel Flippance Jun 21 '15 at 08:54
-
2@DanielFlippance you'd probably want to restore a saved configuration to the newly created environment, as well. See also this link https://blogs.aws.amazon.com/application-management/post/Tx2W35XGG70IIQI/Delete-Your-Stacks-But-Keep-Your-Data – Codebling Jul 07 '15 at 18:25
If you have a load-balanced environment you can try the following trick
$ aws autoscaling update-auto-scaling-group \
--auto-scaling-group-name my-auto-scaling-group \
--min-size 0 --max-size 0 --desired-capacity 0
It will remove all instances from the environment but won't delete the environment itself. Unfortunately you still will pay for elastic load balancer. But usually EC2 is the most "heavy" part.
Does it work for 0?
yes, it does
$ aws autoscaling describe-auto-scaling-groups --region us-east-1 \
--auto-scaling-group-name ASG_NAME \
--query "AutoScalingGroups[].{DesiredCapacity:DesiredCapacity,MinSize:MinSize,MaxSize:MaxSize}"
[
{
"MinSize": 2,
"MaxSize": 2,
"DesiredCapacity": 2
}
]
$ aws autoscaling update-auto-scaling-group --region us-east-1 \
--auto-scaling-group-name ASG_NAME \
--min-size 0 --max-size 0 --desired-capacity 0
$ aws autoscaling describe-auto-scaling-groups --region us-east-1 \
--auto-scaling-group-name ASG_NAME \
--query "AutoScalingGroups[].{DesiredCapacity:DesiredCapacity,MinSize:MinSize,MaxSize:MaxSize}"
[
{
"MinSize": 0,
"MaxSize": 0,
"DesiredCapacity": 0
}
]
And then you can check environment status
$ eb status -v
Environment details for: test
Application name: TEST
Region: us-east-1
Deployed Version: app-170925_181953
Environment ID: e-1234567890
Platform: arn:aws:elasticbeanstalk:us-east-1::platform/Multi-container Docker running on 64bit Amazon Linux/2.7.4
Tier: WebServer-Standard
CNAME: test.us-east-1.elasticbeanstalk.com
Updated: 2017-09-25 15:23:22.980000+00:00
Status: Ready
Health: Grey
Running instances: 0
In the beanstalk webconsole you will see the following message
INFO Environment health has transitioned from Ok to No Data.
There are no instances. Auto Scaling group desired capacity is set to zero.

- 1,345
- 15
- 16
-
[Aws docs](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html#command-options-general-autoscalinglaunchconfiguration) say `aws:autoscaling:asg:minSize` valid values are `1 to 10000`. Does it work for `0`? – DarthVanger Oct 03 '17 at 12:26
eb stop
is deprecated. I also had the same problem and the only solution I could come up with was to backup the environment and then restore it.
Here's a blog post in which I'm explaining it: http://pminkov.github.io/blog/how-to-shut-down-and-restore-an-elastic-beanstalk-environment.html

- 653
- 2
- 5
- 18