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
cfn-signal
的使用不正确。这是因为它在Ubuntu
上比在Amazon Linux
上具有不同位置