Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
$ wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb


For Windows, follow Use the below command to connect to the EC2 instancedownload it for Windows.

Code Block
Invoke-WebRequest -Uri "https://s3.amazonaws.com/amazoncloudwatch-agent/windows/amd64/latest/amazon-cloudwatch-agent.msi" -OutFile "C:\amazon-cloudwatch-agent.msi" 

...

Follow the below command to start the wizard run for Ubuntu:

Code Block
$ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard


Follow the below command to start the wizard run for Windows:

Code Block
cd "C:\Program Files\Amazon\AmazonCloudWatchAgent"
.\amazon-cloudwatch-agent-config-wizard.exe


In the wizard run, there are the config.json file is automatically created. Before the creation of the config.json file, it asked for a number of questions as the Log Agent used to collect system-level metrics, so users need to answer these questions and can ignore the questions that are not related to collecting logs. While using the wizard, users can always take the generated config file and then manually add it to any additional instances. 

Start the Agent

Run the below command to run execute the Agent on Ubuntu Server.

Code Block
$ sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s


Run the below command to execute the Agent on Windows Server.

Code Block
& "C:\Program Files\Amazon\AmazonCloudWatchAgent\amazon-cloudwatch-agent-ctl.ps1" -a fetch-config -m ec2 -s -c file:config.json

View Logs

From the CloudWatch Overview, the user can select Logs from the menu. The user can find the label for the Log Group created in the configuration of Logs. Select the Log Group name to see the Log Streams. Click on the Log Stream uses the EC2 instance ID, so the user knows in which EC2 instance the data is logged.

...