2 Answers
- Newest
- Most votes
- Most comments
0
Hello. Just come across your post. I'm looking for the same solution. Did you eventually go for the lambda method that records the instance state as a tag? Thanks
answered a year ago
0
Thanks for the reply. Yes the pshell method sounds like an easier option. I'm more comfortable with powershell than Lambda, so will try that. Thanks again for your help.
answered a year ago
Relevant content
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago
Hey Kal, I couldn't find anything much on the internet besides suggesting lambda BUT I stumbled upon Systems Manager > Automation .. Which allows you to write "documents", these documents can execute a script or call AWS APIs and all other sorts of neat stuff. https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-automation.html
So what I ended up doing was creating an automation doc that executes a powershell script that finds all powered off EC2 instances, tags them then powers them on. You can then put this automation doc in a maintenance window that runs say monthly. After the instances are patched, you can trigger another doc that shutsdown instances and removes the tags. This method was pretty simple, i dont have much experience with lambda so this approach was much easier to build. I also did stumble upon this doc, which explains how to make a parent-child automation doc which i think will be my ultimate end goal so i can scrap the powershell.
https://docs.aws.amazon.com/systems-manager/latest/userguide/automation-authoring-runbooks-parent-child-example.html