在 CentOS7 中 - 没有可用的软件包 aws-cfn-bootstrap

In CentOS7 - No package aws-cfn-bootstrap available

我正在尝试在 Cent OS 7 中使用带有 cfn 信号的 AWS Cloud Formation 模板。根据 documentation,提到使用

安装
yum install -y aws-cfn-bootstrap
or using RPM..

但是,其中 none 有帮助,只是收到以下错误消息..

No package aws-cfn-bootstrap available.

你应该试试这个:

rpm -Uvh https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.amzn1.noarch.rpm

  1. 您还可以下载文件:

https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz

  1. 提取它: tar -xzvf aws-cfn-bootstrap-latest.tar.gz

另外,详细步骤可以试试AWS论坛的解决方案: https://forums.aws.amazon.com/thread.jspa?messageID=599647

太好了,从 forum 找到了一些有用的信息。然后,以 sudo 用户身份在 CentOS 7 中尝试以下操作。

yum update -y
yum install -y epel-release
yum install -y https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.amzn1.noarch.rpm
ln -s /usr/local/lib/python2.7/site-packages/cfnbootstrap /usr/lib/python2.7/site-packages/cfnbootstrap
ls /opt/aws/bin/

现在,我可以注意到它已成功安装在 /opt/aws/bin/

这是我当前的(工作!)用户数据部分,它在 Centos7 中设置了 aws-cfn-bootstrap。

Properties:
  UserData:
    'Fn::Base64':
      !Sub |
       #!/bin/bash
       yum -y update
       yum -y install wget
       yum -y --enablerepo=extras install epel-release
       yum -y install python-pip
       pip install pystache argparse python-daemon requests
       cd /opt
       curl -O https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz
       curl -O https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.amzn1.noarch.rpm
       tar -xvpf aws-cfn-bootstrap-latest.tar.gz
       cd aws-cfn-bootstrap-1.4/
       python setup.py build
       python setup.py install
       ln -s /usr/init/redhat/cfn-hup /etc/init.d/cfn-hup
       chmod 775 /usr/init/redhat/cfn-hup
       mkdir /opt/aws
       mkdir /opt/aws/bin
       ln -s /usr/bin/cfn-hup /opt/aws/bin/cfn-hup
       set -o errexit
       /usr/bin/cfn-init -v --stack ${AWS::StackName} --resource EC2Instance --region ${AWS::Region}
       /usr/bin/cfn-signal --exit-code $? --stack ${AWS::StackName} --resource EC2Instance --region ${AWS::Region}

干杯,祝你好运!