skip to Main Content

I am facing an issue that I have integrated a lambda function for auto starting and stopping of a EC2 instance according to my office hours. However, The issue is that EC2 is on ASG and ASG creates redundant Instance automatically.
Could someone please suggest a way to schedule ASG operation to stop and start according to my requirements other than disabling the ASG or removing that instance from ASG.

2

Answers


  1. Chosen as BEST ANSWER

    I solved this case by using automatic Scaling and creating one schedule to shut down by putting 0s in desired, min and max capacity. And another scheduled to start by putting 1s in desired, min and max capacity(since my requirement is 1 instance at a time) I am not sure if this is the best practice but I solved my issue via this technique.


  2. You can suspend an Auto Scaling group (ASG) according to your EC2 auto-start and stop schedule by using AWS Lambda functions. Lambda functions can be used to trigger the ASG suspend and resume actions at the desired times. You can also use CloudWatch Events to trigger the Lambda functions at the desired times.
    More details here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search