Download and configure the CloudWatch agent using the command line
You can use the following steps to download the CloudWatch agent package, create IAM roles or users, and optionally modify the common configuration file.
Download the CloudWatch agent package
Note
To download the CloudWatch agent, your connection must use TLS 1.2 or later.
The CloudWatch agent is available as a package in Amazon Linux 2023 and Amazon Linux 2. If you are using this operating system, you can install the package by entering the following command. You must also make sure that the IAM role attached to the instance has the CloudWatchAgentServerPolicy attached. For more information, see Create IAM roles and users for use with CloudWatch agent.
sudo yum install amazon-cloudwatch-agent
On all supported operating systems, you can download and install the CloudWatch agent using the command line.
For each download link, there is a general link as well as links for each Region. For example, for Amazon Linux 2023 and Amazon Linux 2 and the x86-64 architecture, three of the valid download links are:
-
https://amazoncloudwatch-agent.s3.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
-
https://amazoncloudwatch-agent-us-east-1.s3.us-east-1.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
-
https://amazoncloudwatch-agent-eu-central-1.s3.eu-central-1.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
You can also download a README file about the latest changes to the agent, and a file that indicates the version number that is available for download. These files are in the following locations:
-
https://amazoncloudwatch-agent.s3.amazonaws.com/info/latest/RELEASE_NOTES
orhttps://amazoncloudwatch-agent-
region
.s3.region
.amazonaws.com/info/latest/RELEASE_NOTES -
https://amazoncloudwatch-agent.s3.amazonaws.com/info/latest/CWAGENT_VERSION
orhttps://amazoncloudwatch-agent-
region
.s3.region
.amazonaws.com/info/latest/CWAGENT_VERSION
Architecture | Platform | Download link | Signature file link |
---|---|---|---|
x86-64 |
Amazon Linux 2023 and Amazon Linux 2 |
https://amazoncloudwatch-agent.s3.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm.sig https://amazoncloudwatch-agent- |
x86-64 |
Centos |
https://amazoncloudwatch-agent.s3.amazonaws.com/centos/amd64/latest/amazon-cloudwatch-agent.rpm https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/centos/amd64/latest/amazon-cloudwatch-agent.rpm.sig https://amazoncloudwatch-agent- |
x86-64 |
Redhat |
https://amazoncloudwatch-agent.s3.amazonaws.com/redhat/amd64/latest/amazon-cloudwatch-agent.rpm https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/redhat/amd64/latest/amazon-cloudwatch-agent.rpm.sig https://amazoncloudwatch-agent- |
x86-64 |
SUSE |
https://amazoncloudwatch-agent.s3.amazonaws.com/suse/amd64/latest/amazon-cloudwatch-agent.rpm https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/suse/amd64/latest/amazon-cloudwatch-agent.rpm.sig https://amazoncloudwatch-agent- |
x86-64 |
Debian |
https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/amazon-cloudwatch-agent.deb https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/debian/amd64/latest/amazon-cloudwatch-agent.deb.sig https://amazoncloudwatch-agent- |
x86-64 |
Ubuntu |
https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb.sig https://amazoncloudwatch-agent- |
x86-64 |
Oracle |
https://amazoncloudwatch-agent.s3.amazonaws.com/oracle_linux/amd64/latest/amazon-cloudwatch-agent.rpm https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/oracle_linux/amd64/latest/amazon-cloudwatch-agent.rpm.sig https://amazoncloudwatch-agent- |
x86-64 |
macOS |
https://amazoncloudwatch-agent.s3.amazonaws.com/darwin/amd64/latest/amazon-cloudwatch-agent.pkg https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/darwin/amd64/latest/amazon-cloudwatch-agent.pkg.sig https://amazoncloudwatch-agent- |
x86-64 |
Windows |
https://amazoncloudwatch-agent.s3.amazonaws.com/windows/amd64/latest/amazon-cloudwatch-agent.msi https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/windows/amd64/latest/amazon-cloudwatch-agent.msi.sig
https://amazoncloudwatch-agent- |
ARM64 |
Amazon Linux 2023 and Amazon Linux 2 |
https://amazoncloudwatch-agent.s3.amazonaws.com/amazon_linux/arm64/latest/amazon-cloudwatch-agent.rpm https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/amazon_linux/arm64/latest/amazon-cloudwatch-agent.rpm.sig https://amazoncloudwatch-agent- |
ARM64 |
Redhat |
https://amazoncloudwatch-agent.s3.amazonaws.com/redhat/arm64/latest/amazon-cloudwatch-agent.rpm https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/redhat/arm64/latest/amazon-cloudwatch-agent.rpm.sig https://amazoncloudwatch-agent- |
ARM64 |
Ubuntu |
https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/arm64/latest/amazon-cloudwatch-agent.deb https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/arm64/latest/amazon-cloudwatch-agent.deb.sig https://amazoncloudwatch-agent- |
ARM64 |
Debian |
https://amazoncloudwatch-agent.s3.amazonaws.com/debian/arm64/latest/amazon-cloudwatch-agent.deb https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/debian/arm64/latest/amazon-cloudwatch-agent.deb.sig https://amazoncloudwatch-agent- |
ARM64 |
SUSE |
https://amazoncloudwatch-agent.s3.amazonaws.com/suse/arm64/latest/amazon-cloudwatch-agent.rpm https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/suse/arm64/latest/amazon-cloudwatch-agent.rpm.sig https://amazoncloudwatch-agent- |
ARM64 |
MacOS |
https://amazoncloudwatch-agent.s3.amazonaws.com/darwin/arm64/latest/amazon-cloudwatch-agent.pkg https://amazoncloudwatch-agent- |
https://amazoncloudwatch-agent.s3.amazonaws.com/darwin/arm64/latest/amazon-cloudwatch-agent.pkg.sig https://amazoncloudwatch-agent- |
To use the command line to download and install the CloudWatch agent package
-
Download the CloudWatch agent.
On a Linux server, enter the following. For
download-link
, use the appropriate download link from the previous table.wget
download-link
On a server running Windows Server, download the following file:
https://amazoncloudwatch-agent.s3.amazonaws.com/windows/amd64/latest/amazon-cloudwatch-agent.msi
-
After you have downloaded the package, you can optionally verify the package signature. For more information, see Verifying the signature of the CloudWatch agent package.
-
Install the package. If you downloaded an RPM package on a Linux server, change to the directory containing the package and enter the following:
sudo rpm -U ./amazon-cloudwatch-agent.rpm
If you downloaded a DEB package on a Linux server, change to the directory containing the package and enter the following:
sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
If you downloaded an MSI package on a server running Windows Server, change to the directory containing the package and enter the following:
msiexec /i amazon-cloudwatch-agent.msi
This command also works from within PowerShell. For more information about MSI command options, see Command-Line Options
in the Microsoft Windows documentation. If you downloaded a PKG package on a macOS server, change to the directory containing the package and enter the following:
sudo installer -pkg ./amazon-cloudwatch-agent.pkg -target /
Create and modify the agent configuration file
After you have downloaded the CloudWatch agent, you must create the configuration file before you start the agent on any servers. For more information, see Create the CloudWatch agent configuration file.