aws-samples / aws-systemsmanagerautomation-with-asglifecyclehooks

CloudFormation template using Amazon EC2 Auto Scaling Lifecycle Hooks to perform any desired actions before terminating the instance within the Auto Scaling group.
https://aws.amazon.com/blogs/infrastructure-and-automation/run-code-before-terminating-an-ec2-auto-scaling-instance/
MIT No Attribution
14 stars 14 forks source link

Automation Step Execution fails when it is creating the image #2

Open zzmohammed opened 1 year ago

zzmohammed commented 1 year ago

get this message when I try to test this out with terminating EC2....

Automation Step Execution fails when it is creating the image. Get Exception from CreateImage API of ec2 Service. Exception Message from CreateImage API: [Invalid value 'i-02270eb84383eb2c3' for instanceId. Instance is not in state 'running' or 'stopping' or 'stopped' (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterValue; Request ID: feb689ef-b2c0-4464-98be-2cc49d7c8625; Proxy: null)]. Please refer to Automation Service Troubleshooting Guide for more diagnosis details.

aaalzand commented 5 months ago

Thanks for reaching out. Are you still running into this issue? I will review CloudTrail to check the event timeline if there is another process or API that terminates the instance before executing the automation document.