Is there any way to stop an elastic beanstalk environment as opposed to terminating it? There are times during testing that I would prefer to stop the environment so that I'm not being charged. However, I'm not seeing a way to do this via the GUI. It is very inconvenient to have to terminate and re-create my environment.
-
You can schedule it to have 0 instance or use `eb scale` Check out https://jun711.github.io/aws/how-to-pause-or-stop-elastic-beanstalk-environment-from-running/ for more information on how to do it. – Jun Aug 17 '19 at 03:22
3 Answers
Currently, there's no easy way to suspend an environment. There's also no easy way to have a maintenance page for your environment while your instances are down.
When you set the number of instances to 0, the instances will terminate but you'll have to do this all manually as the EB console does not allow an entry of 0. You can do this by running this:
as-update-auto-scaling-group YourAutoScalingGroupID --min-size 0 --max-size 0 --desired-capacity 0
This, however, only terminates your instances. Everything else is still running, like your ELB. You can then change it back to your previous settings when you're done.
![](../../users/profiles/379699.webp)
- 382
- 1
- 4
- 14
-
2you should specify sources: https://forums.aws.amazon.com/thread.jspa?threadID=121273 (hubert@AWS's comment). – naXa stands with Ukraine Apr 29 '19 at 07:11
An Amazon Customer found a simple way to do this with single instance environments.
You can keep an elastic beanstalk environment setup 24/7, and stop only the associated EC2 instance to save money.
To set it up, go to your EC2 console, click Auto Scaling Groups (a group is set up for single instance environments, despite the absence of an ELB). Click your group (check the tags tab to find the right one). Under the details tab, click "edit" and update "Min" to be 0. Now go to the Instances tab and set the instance here to Standby.
You can now toggle your EC2 instance on/off whenever you like using the EC2 Instances console, and elastic beanstalk won't freak out and terminate/re-create anything. You don't even have to put the instance back InService, it will begin to serve on your elastic beanstalk
CNAME
as soon as it boots back up.
source (Amazon Customer's comment)
When I tried this solution myself I was not able to find Suspend action. Currently, there're only Stop and Terminate actions at Instances tab. And when you choose any, AWS warns you that any data saved to ephemeral storage will be lost.
![](../../users/profiles/313654.webp)
- 495
- 1
- 5
- 11
On AWS Elastic Beanstalk environment, you can use time-based scaling and schedule it to have 0 instance at some time in the future.
You can also use eb scale count environment-name
to scale it to 0 instance.
Check out Pause Elastic Beanstalk instance article for more information.
![](../../users/profiles/475207.webp)
- 111
- 3