Amazon CloudWatch 代理日志记录错误和输出

Amazon CloudWatch 代理日志记录错误和输出

我在特定 EC2 实例上使用 CloudWatch 代理时遇到问题。我已在其他几个实例上进行了测试,没有问题。我已将此处指定的已定义 CloudWatch 代理 IAM 角色附加到实例(也包括测试实例):https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/create-iam-roles-for-cloudwatch-agent.html

连接后,我安装到实例(Ubuntu 16,与测试实例相同),运行向导,然后启动代理。我对 .conf 所做的唯一修改是从默认 CWAgent 更改命名空间。

我只在这一个实例上遇到了问题。以下是日志输出:。请注意,此实例(以及测试实例)未安装 awscli,并且未存储定义的 aws 凭证。

2021-05-09T08:14:56Z E! cloudwatch: code: NoCredentialProviders, message: no valid providers in chain, original error: EnvAccessKeyNotFound: failed to find credentials in the environment.
caused by: SharedCredsLoad: failed to load profile, .
EC2RoleRequestError: no EC2 instance role found
caused by: EC2MetadataError: failed to make EC2Metadata request
    status code: 404, request id: 
caused by: <?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>404 - Not Found</title>
 </head>
 <body>
  <h1>404 - Not Found</h1>
 </body>
</html>

相关内容