Fail/Rollback EC2 Instance Provisioning if UserData Fails

0

Is it possible to fail or rollback EC2 instance provisioning, if UserData fails? Let's say I execute some PowerShell scripts as part of UserData provisioning and some scripts fail. I want to fail the EC2 provisioning with the errors. Please help

asked a year ago209 views
1 Answer
0
Accepted Answer

If you deploy the instance via Cloudformation, you can utilize the cfn-helper scripts to achieve this. Specifically, the cfn-signal script is what you would use, along with Clouformation wait conditions to signal that the script succeeded or failed.

profile pictureAWS
answered a year ago
  • Thanks a lot for your prompt response. However, I have a couple of questions. Will this work for Windows Instance.? I am trying to implement this in an Auto Scaling Group scenario. Will it work? Can you please share any example, if possible? Thanks a lot once again.

  • Thanks a lot for the hint. This helped me, although I had to make some changes.

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