Uploaded image for project: 'IGB'
  1. IGB
  2. IGBF-2531

Investigate: Lambda function to shuts down EC2s at 18:30 every day

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None

      Description

      We have many EC2's used for development purposes.

      EC2's with tag "Stack" equal to "Develop" are all used for development purposes only.

      To save money, we should change their status to "Stopped" at the end of very workday - 6:30 pm Easter Standard Time.

      Currently, Dr. Loraine manually does this - when she remembers to do it.

      We need an automated approach instead.

      A lambda function attached to the Loraine Lab account would probably be the best approach - it is simple and relatively easy to set up.

      For example, according to this documentation – https://aws.amazon.com/premiumsupport/knowledge-center/start-stop-lambda-cloudwatch/ – you can create a lambda function that would then be triggered by a timer configured in cloudwatch.

      Alternatively, you can do something like this - read: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/UsingAlarmActions.html#AddingStopActions

      For this task, investigate the best way to automate stopping ECs with Stack equal to Develop. It should be super simple and easy for Dr. Loraine to manage and maintain.

      Give an overview of the solution here.

        Attachments

          Issue Links

            Activity

            Hide
            aloraine Ann Loraine added a comment -

            Thank you very much for the explanation. It is very helpful!

            Show
            aloraine Ann Loraine added a comment - Thank you very much for the explanation. It is very helpful!
            Hide
            aloraine Ann Loraine added a comment -

            Confirming: EC2s in the loraine lab account got shut down at the proper time via cloudwatch.
            Thank you Chirag Chandrahas Shetty for the very helpful code!

            Show
            aloraine Ann Loraine added a comment - Confirming: EC2s in the loraine lab account got shut down at the proper time via cloudwatch. Thank you Chirag Chandrahas Shetty for the very helpful code!
            Hide
            aloraine Ann Loraine added a comment -

            need to update cloudwatch for daylight savings time

            Show
            aloraine Ann Loraine added a comment - need to update cloudwatch for daylight savings time
            Hide
            chirag24 Chirag Chandrahas Shetty added a comment -

            Ann Loraine We can change the string in step 3 from "30 22 * * ? *" to "30 23 * * ? *".

            Show
            chirag24 Chirag Chandrahas Shetty added a comment - Ann Loraine We can change the string in step 3 from "30 22 * * ? *" to "30 23 * * ? *".
            Hide
            aloraine Ann Loraine added a comment -

            Thank you - it is done!

            Show
            aloraine Ann Loraine added a comment - Thank you - it is done!

              People

              • Assignee:
                chirag24 Chirag Chandrahas Shetty
                Reporter:
                aloraine Ann Loraine
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: