Anastázie
Anastázie

Reputation: 23

cfn-signal no working in ubuntu stack timeout

TestInstance:
  Type: AWS::EC2::Instance
  CreationPolicy:
    ResourceSignal:
      Timeout: PT5M
  Properties:                
    ImageId: ami-02a599eb01e3b3c5b      
    InstanceType: t2.micro
    KeyName: TestKey   
    SecurityGroupIds: !Ref sg
    UserData: 
      Fn::Base64: |
          #!/bin/bash -x               
          apt install -y python-pip
          pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz                                              
          /opt/aws/bin/cfn-signal -e $? --stack teststack --resource TestInstance --region ap-southeast-2

Upvotes: 2

Views: 810

Answers (1)

Marcin
Marcin

Reputation: 238169

Your use of cfn-signal is incorrect. This is because it has different location on Ubuntu than on Amazon Linux.

  • Amazon Linux: /opt/aws/bin/cfn-signal
  • Ubuntu: /usr/local/bin/cfn-signal

Therefore, instead of

/opt/aws/bin/cfn-signal -e $? --stack teststack --resource TestInstance --region ap-southeast-2

you should have :

/usr/local/bin/cfn-signal -e $? --stack teststack --resource TestInstance --region ap-southeast-2

If this won't help, please double check that teststack and ap-southeast-2 are correct. Also make sure the instance has internet access.

Upvotes: 2

Related Questions