kagarlickij
kagarlickij

Reputation: 8107

Fail CloudFormation stack if EC2 cfn-init fails

I use CloudFormation to provision EC2 instances (via ASG and LaunchTemplate),

Is it possible to Fail CloudFormation stack if EC2 cfn-init command fails?

Upvotes: 0

Views: 239

Answers (2)

jijo
jijo

Reputation: 111

You could try cfn-signal to send out SUCCESS/FAILED signals

You can check this example where they use cfn-signal along with cfn-init and function error_exit will send failure signal if execution was failed.

Upvotes: 1

Marakai
Marakai

Reputation: 1212

Failure of cfn-init will cause the stack to fail, however the time out can be quite long.

Use

CreationPolicy:
  ResourceSignal:
    Timeout: PT15M

in your Resource. Adjust the Timeout as you require.

Upvotes: 2

Related Questions