Installing packages using apt-get in CloudFormation file

前端 未结 2 937
迷失自我
迷失自我 2021-01-14 01:08

I\'ve got the following CloudFormation script. The stack is being created and the Ec2 instance launches, and I can SSH in but it\'s not installing the packages.

I\'m

2条回答
  •  滥情空心
    2021-01-14 01:33

    The issue with the template above is that cfn-init is not installed in the Ubuntu AMI, so the call to cfn-init in your user-data script will return "command not found" and do nothing.

    The cfn-helper utilities are automatically installed only in the latest Amazon Linux AMI, as noted in the documentation. For Ubuntu you need to install them manually, which you can do by adding a line to your existing user-data script, after "#!/bin/bash\n",:

    "apt-get update && apt-get install pip && pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz\n",
    

    After this, the call to /usr/local/bin/cfn-init in the next line should run correctly.

提交回复
热议问题