How Do You Set up (Install and Configure) AWS CloudWatch?

Update 11/22/17

Problem scenario

You want to use CloudWatch.  What steps do you need to take initially to have it work on a Linux server?

Solution
Prerequisites
Prerequisite #1  The server must be an EC-2 instance (not a non-AWS server) with AWS CLI installed (but not necessarily configured).  For directions on installing AWS CLI, see this link.

Prerequisite #2  One of the following (a or b) must be met:

a)  AWS CLI is configured on this Linux server.

OR

b)  You must have your default region name, AWS Access Key ID, and AWS Secret Access Key ready.  If you know these values, start with step #1 below.  Otherwise to retrieve the region name, in the console find the portion of the URL that is to the right of the "=" sign.  For example, "us-east-1" is to the right of the "=" sign.  To find the AWS Access Key ID and AWS Secret Access Key, in the AWS console, click on your name in the upper right hand corner. Click on "My Security Credentials."  Click "Create New Access Key." Then click "Show Access Key."

End of prerequisites.

Procedures
Step #1  On the Linux server, run this command:

wget https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py

Step #2  Run this command but replace "us-east-1" with the region of your choice:

sudo python ./awslogs-agent-setup.py --region --us-east-1

#  Follow the prompts.  If the AWS CLI was already configured, you should be able to accept the defaults.

Step #3  In a few moments, you'll be able to view the logs.  In a regular web browser open this URL after you modify it by replacing "us-east-1" to be the region you chose in the above command: 

https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:

Step #4  You are done.

FYI
Several months after this posting above was published, AWS published an article about CloudWatch.  It helps given an overview of this monitoring service.

Leave a comment

Your email address will not be published.