Logging EC2 power state before maintenance window, then return to that state

0

Hello All, I need to patch EC2 instances that are currently powered down and return them to this state after patching. I'm trying to figure out if there is an easy way to track the power state of an EC2 instance before starting it for a maintenance window. I know maintenance windows automation tasks can power on and power off EC2 instances, but how would it keep track of an instances state so I can return it to that state after the maintenance window is over? After googleing for days, I've read a few people suggesting you can trigger a lambda function to run first and tag your instances with a state tag, once your maint window is over, you run another lamba that captures all instances with the tag state of say "powerOffWhenDone" and you then power them off and remove the tag. Can anybody suggest any other methods their currently using? I cant find much in regards to this topic.

2 Answers
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

Kal
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.

Kal
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions