How do I set the instance count of a Elastic Beanstalk environment to 0?

Viewed 1534

In other words I would like to temporarily turn off an environment (and its associated billing costs) but not delete it entirely.

It seems if I set the [Configuration > Web Tier > Scaling > Minimum instance count] to 0 along with the related "Maximum instance count", AWS rejects those settings as invalid. Ditto for questionable values like 0.1.

Any ideas for temporarily taking an Elastic Beanstalk environment out of service?

4 Answers

You can achieve this by defining time periods in your environment.

from your Elastic Load blanancer dashboard navigate through: Configuration -> Capacity -> Time-based scaling -> Scheduled actions.

You may choose to use multiple scheduled actions to start and stop your environment.

i.e. One to start your environment and another to stop it, or scale out during high load periods and back in after.

In the background, Elastic Beanstalk will terminate and recreate the EC2. This means you'll lose any data on the instances local storage.

shows the Scheduled actions screen in aws

I have used this to turn my environments off when they are no longer needed. For example, I have a workload that crawls looking for new content; and I pause this crawling after it has once completed. I also use this feature to spin down my nonproduction environments outside of working hours.

I prefer this method to others as it is supported by both single instance and load-balanced environments.

I now use the ParkMyCloud service to suspend Elastic Beanstalk environments (and also RDS database instances) that I'm not using, both manually and in scheduled fashion.

Although ParkMyCloud is non-free, it's saved me a lot more money than I've spent using it. It's worked quite well over the last few years so I'm comfortable recommending it.

Related