OnCallReadyStart learning

cfn-signal: send a success or failure signal for a CloudFormation resource with a CreationPolicy (aws-cfn-bootstrap)

cfn-signal -e EXIT_CODE --stack STACK --resource LOGICAL_ID --region REGION

Options you will use

-e, --exit-code CODE
0 = SUCCESS, anything else = FAILURE (usually -e $? after the setup command)
-s, --stack NAME
the stack name or ID
-r, --resource ID
the logical ID of the resource with the CreationPolicy (the instance or Auto Scaling group)
--region REGION
the stack's Region
-i, --id ID
a unique ID for this signal (default: the instance ID)

Examples

$ cfn-signal -e $? --stack web --resource WebServer --region eu-central-1

from the user data, after the setup (on Amazon Linux: /opt/aws/bin/cfn-signal; on Ubuntu, pip-install aws-cfn-bootstrap first)

$ cfn-signal -e 1 --stack web --resource WebServer

report a failure: the stack rolls back now instead of after the timeout

Gotchas

Try cfn-signal in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.