Try to find EC2 Instance’s UserData made by CloudFormation
$ sudo ls -la /var/lib/cloud/instance/scripts total 12 drwxr-xr-x 2 root root 4096 Feb 6 02:25 . drwxr-xr-x 5 […]
広告ここから
広告ここまで
目次
$ sudo ls -la /var/lib/cloud/instance/scripts total 12 drwxr-xr-x 2 root root 4096 Feb 6 02:25 . drwxr-xr-x 5 root root 4096 Feb 6 02:38 .. -rwx------ 1 root root 1278 Feb 6 02:38 part-001
If you open part-01
, you can see your EC2 Instance UserData scripts
$ sudo cat /var/lib/cloud/instance/scripts/part-001 #!/bin/sh -xe yum update -y function error_exit{ /opt/aws/bin/cfn-signal -e 1 -r $1 https://cloudformation-waitcondition-us-west-2.s3-us-west-2.amazonaws.com/XXXXXXXXXXXXXXXXXXX exit 1 } yum install -y aws-cfn-bootstrap /opt/aws/bin/cfn-init -v --stack a999 --resource EC2 --configsets default --region us-west-2 # || error_exit 'Failed to run cfn-init' /opt/aws/bin/cfn-signal -e $? -r $1 https://cloudformation-waitcondition-us-west-2.s3-us-west-2.amazonaws.com/XXXXXXXXXXXXXXXXXXX
And it can run by manually
$ sudo /var/lib/cloud/instance/scripts/part-001