使用命令行下载和配置 CloudWatch 代理
您可以使用以下步骤来下载 CloudWatch 代理软件包,创建 IAM 角色或用户,以及(可选)修改常见配置文件。
下载 CloudWatch 代理软件包
注意
要下载 CloudWatch 代理,您的连接必须使用 TLS 1.2 或更高版本。
您可以使用 Amazon S3 下载链接下载 CloudWatch 代理软件包。根据您的架构和平台,从该表中选择下载链接。
架构 | 平台 | 下载链接 | 签名文件链接 |
---|---|---|---|
amd64 |
Amazon Linux 2023 和 Amazon Linux 2 |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm.sig |
amd64 |
Centos |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/centos/amd64/latest/amazon-cloudwatch-agent.rpm |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/centos/amd64/latest/amazon-cloudwatch-agent.rpm.sig |
amd64 |
Redhat |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/redhat/amd64/latest/amazon-cloudwatch-agent.rpm |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/redhat/amd64/latest/amazon-cloudwatch-agent.rpm.sig |
amd64 |
SUSE |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/suse/amd64/latest/amazon-cloudwatch-agent.rpm |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/suse/amd64/latest/amazon-cloudwatch-agent.rpm.sig |
amd64 |
Debian |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/debian/amd64/latest/amazon-cloudwatch-agent.deb |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/debian/amd64/latest/amazon-cloudwatch-agent.deb.sig |
amd64 |
Ubuntu |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb.sig |
amd64 |
Windows |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/windows/amd64/latest/amazon-cloudwatch-agent.msi |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/windows/amd64/latest/amazon-cloudwatch-agent.msi.sig |
ARM64 |
Amazon Linux 2023 和 Amazon Linux 2 |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/amazon_linux/arm64/latest/amazon-cloudwatch-agent.rpm |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/amazon_linux/arm64/latest/amazon-cloudwatch-agent.rpm.sig |
ARM64 |
Redhat |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/redhat/arm64/latest/amazon-cloudwatch-agent.rpm |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/redhat/arm64/latest/amazon-cloudwatch-agent.rpm.sig |
ARM64 |
Ubuntu |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/ubuntu/arm64/latest/amazon-cloudwatch-agent.deb |
https://s3.cn-north-1.amazonaws.com.cn/amazoncloudwatch-agent/ubuntu/arm64/latest/amazon-cloudwatch-agent.deb.sig |
使用命令行下载和安装 CloudWatch 代理软件包
-
下载 CloudWatch 代理。
在 Linux 服务器上,输入以下命令。对于
download-link
,请使用上表中的相应下载链接。wget
download-link
在运行 Windows Server 的服务器上,下载以下文件:
-
在下载该软件包后,您可以选择验证软件包签名。有关更多信息,请参阅 验证 CloudWatch 代理软件包的签名。
-
安装 软件包。如果已在 Linux 服务器上下载 RPM 程序包,请更改为包含程序包的目录,并输入以下内容:
sudo rpm -U ./amazon-cloudwatch-agent.rpm
如果已在 Linux 服务器上下载 DEB 程序包,请更改为包含程序包的目录,并输入以下内容:
sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
如果已运行在 Windows Server 的服务器上下载 MSI 程序包,请更改为包含程序包的目录,并输入以下内容:
msiexec /i amazon-cloudwatch-agent.msi
此命令还可在 PowerShell 中发挥作用。有关 MSI 命令选项的更多信息,请参阅 Microsoft Windows 文档中的命令行选项
。 如果已在 macOS 服务器上下载 PKG 程序包,请更改为包含程序包的目录,并输入以下内容:
sudo installer -pkg ./amazon-cloudwatch-agent.pkg -target /
创建和修改代理配置文件
在下载 CloudWatch 代理后,您必须先创建配置文件,然后再在任何服务器上启动该代理。有关更多信息,请参阅 创建 CloudWatch 代理配置文件。