Installing packages using apt-get in CloudFormation file

戏子无情 提交于 2019-12-01 08:21:37

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.

You need to include the Cloudformation Init attribute in the Metadata property of the instance. The cfn-init script uses this meta data to determine what actions should be taken on boot.

In your sample code though, it does not look like you are even trying to install any packages, so I am not sure what package you are expecting to be present.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!