We help IT Professionals succeed at work.
Get Started

AWS -  Lambda to change auto-scaling to 0

Mat Smith
Mat Smith asked
Last Modified: 2019-04-01
Hi Guys,

I have a test environment in AWS, which consists of 5 EC2 units. Each EC2 is in separate autoscaling group with min 1 and max 4.
What I want to do is terminate all 5 servers every day at 10 pm and recreate them at 8 am.  This can't achieve by stopping an EC2 because autoscaling spins out a new instance straightaway.

I found this article, which says about setting the desired capacity.

My question is  - is it possible to write a lambda function, which will amend autoscaling to 0 ? If so, can I have an example please ?
Watch Question
DevOps Engineer
Distinguished Expert 2018
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE