Questions tagged with DevOps

Content language: English

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Starting targeted instances during a maintenance window?

I have a small resource group (5 instances), and there's a weekly script I would like to run on all 5 of them. They start automatically when their users need to interact with them, and stop automatically when idle for 30 minutes. (Similar to a Cloud9 IDE environment, but not managed by Cloud9.) The maintenance window is scheduled for a time when they would all be stopped. There is no reliable time when I know for sure that they would all be running. When the weekly maintenance window rolls around, I would like SSM to start the instances, run the shell script on them, and then stop them. I thought I had managed it, by creating a maintenance window with three tasks: - Priority 10: `AUTOMATION` task using the `AWS-StartEC2Instance` document - Priority 20: `RUN_COMMAND` task using the `AWS-RunShellScript` document - Priority 30: `AUTOMATION` task using the `AWS-StopEC2Instance` document All three tasks specify the resource group as the target, and `{{RESOURCE_ID}}` as the `InstanceId` parameter. The problem is that each task only runs on instances that are already running when the maintenance window starts, which would seem to make the `AWS-StartEC2Instance` automation kind of pointless. When there are no instances running, each task has a status of `No invocations to execute.` I could certainly use an EventBridge rule with a Lambda to make sure the instances are up and running, and then just have the `RunShellScript` task in the maintenance window. But the use case I described above seems like it would be a no-brainer easy thing to accomplish, so I'm concerned I'm just missing something simple. Any suggestions?
2
answers
0
votes
49
views
mbklein
asked 2 months ago