cfn-signal

Description

The cfn-signal helper script signals AWS CloudFormation to indicate whether Amazon EC2 instances have
been successfully created or updated. If you install and configure software applications
on instances, you can signal AWS CloudFormation when those software applications are ready.

You use the cfn-signal script in conjunction with a CreationPolicy
or an Auto Scaling group with a WaitOnResourceSignals update policy. When AWS CloudFormation creates or
updates resources with those policies, it suspends work on the stack until the resource
receives the requisite number of signals or until the timeout period is exceeded. For
each valid signal that AWS CloudFormation receives, AWS CloudFormation publishes the signals to the stack events
so that you track each signal. For a walkthrough that uses a creation policy and
cfn-signal, see Deploying Applications on Amazon EC2 with AWS CloudFormation.

Syntax for Resource Signaling (Recommended)

If you want to signal AWS CloudFormation resources, use the following syntax.

Note

cfn-signal does not require credentials, so you do not need to use the
--access-key, --secret-key, --role, or
--credential-file options.

The stack name or stack ID that contains the resource you want to
signal.

Type: String

Yes

-u, --url (resource signaling only)

The AWS CloudFormation endpoint to use.

Type: String

No

waitconditionhandle.url (wait condition handle
only)

A presigned URL that you can use to signal success or failure to an
associated WaitCondition

Type: String

Yes

Example

Amazon Linux Example

A common usage pattern is to use cfn-init and cfn-signal together. The cfn-signal
call uses the return status of the call to cfn-init (using the $? shell construct).
If the application fails to install, the instance will fail to create and the stack
will rollback. For Windows stacks, see Bootstrapping AWS CloudFormation Windows Stacks.