如何在使用 Chef 设置 CloudWatch 时提供访问密钥和其他信息


嗨,我

正在尝试创建一个厨师食谱来安装云监视代理,我有类似此示例的内容:

execute 'gexecutescripts' do
    command 'sudo python ./awslogs-agent-setup.py --region us-east-1'
    action :run
end 

我得到以下输出:

Step 1 of 5: Installing pip ...DONE
Step 2 of 5: Downloading the latest CloudWatch Logs agent bits ... DONE
Step 3 of 5: Configuring AWS CLI ...
AWS Access Key ID [****************]:
Step 4 of 5: Configuring the CloudWatch Logs Agent ...
Path of log file to upload [/var/log/syslog]:
STDERR: EOF when reading a line
Traceback (most recent call last):
  File "./awslogs-agent-setup.py", line 1144, in <module>
    main()
  File "./awslogs-agent-setup.py", line 1140, in main
    setup.setup_artifacts()
  File "./awslogs-agent-setup.py", line 705, in setup_artifacts
    self.aws_logs_configure()
  File "./awslogs-agent-setup.py", line 805, in aws_logs_configure
    log_file_path = prompter.get_value(default_log_file_path, file_path_msg)
  File "./awslogs-agent-setup.py", line 986, in get_value
    response = input("%s [%s]: " % (prompt_text, current_value))
EOFError: EOF when reading a line

如何从我的配方中传递访问密钥、密钥和其他值?

在 Chef 配方中设置配置文件的访问密钥有点麻烦,因此最好将 IAM 角色提供给 EC2 实例。

有关详细信息,请参阅以下文档:http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html

最新更新