Creation of an AWS CloudFormation stack fails with the error message "WaitCondition timed out. Received 0 conditions when expecting 1."

This error occurs when the URL generated by the WaitHandle does not receive the success signal specified by the count property in the wait condition.

This error most commonly occurs under the following conditions:

  • The wait condition is not being signaled properly from the UserData, or UserData is failing to execute the cfn-signal.
  • Absence of cfn-init tools on the instance used for signaling.
  • The metadata execution takes more time to execute than the value specified by the Timeout property for the wait condition.

    For example, in the following snippet, a space is missing between 0 and " which causes the wait condition to time out; the right endpoint is never signaled even if cfn-init is successfully launched:
         "/opt/aws/bin/cfn-signal -e 0", {"Ref": "waithandle"}\n"
  • Check the cfn-init log file ( /var/log/cfn-init.log ). You can get a rough estimate of the time required for execution of metadata. You can adjust the timeout in the wait condition accordingly.
  • Access the instance and verify that the cfn tools exist under /opt/aws/bin (which is the default location for the Amazon Linux AMI).
  • Double-check the UserData for possible syntax errors. For example, you can use redirect operators to confirm successful completion of command execution:
         "/opt/aws/bin/cfn-signal -e 0 ", {"Ref": "waithandle"}, " >> /tmp/userdata.log\n

AWS CloudFormation, stack, create, cfn-init, wait condition, WaitHandle, success signal

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center.