문제

I have spent many hours to figure out why my CloudFormation template failed using WaitCondition. The template error out: WaitCondition timed out. Received 0 conditions when expecting 1 . Note that I did make sure that my AMI has cfn-signal command preinstall in my AMI.

I have attached following screenshot of my template:

enter image description here

I googled and found some people have the same issue like: http://virtuallyhyper.com/2013/02/cloudformation-waitcondition-timed-out-error/ . However, in my case, the cfn-signal command does exist. So until now I still don't know how to fix the issue.

Thanks

도움이 되었습니까?

해결책

Ok, the problem is because you're using an auto-scaling launch config. Wait signals only really work when creating a real instance. Otherwise cloud formation creating the scaling group, and is waiting for an instance that is only created after your scaling group decides it needs to scale up one or more instances. Unfortunately, because the rest of the scaling group is waiting for a signal to be signalled (by a concrete instance), the scaling group never registers, therefore never creates the instance. Kind of a deadlock - or at the very list - an exceedingly long period of time forcing the timeout.

  • Cloud Formation won't complete registration of the scaling group until the wait is signalled
  • The wait will only signal after the registration of the scaling group AND an instance is created.

If you remove the launch config, and have it create a concrete instance - then your wait condition will signal.

다른 팁

Did the instance get launched on EC2 ? If yes, can your instance reach your node which is running the Cloud formation ? I ran into these issues and discovered that since I was behind a firewall, the AWS instance cannot reach my node and the node times out waiting for the instance to connect back.

You shouldn't use sudo in UserData scripts. They are run as root.

I have a couple of ideas:

In all the examples I've seen, and in my own templates, I use the full path to cfn-init:

  • /opt/aws/bin/cfn-init
  • /opt/aws/bin/cfn-signal

Have you tried to use the cfn-init command without the "-c install"?

I encountered the same problem and tried everything above. I changed the wait timeout to 3000 and was successful.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top