Versions Compared

Key

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

...

Amazon AWS® CloudWatch is a service of Amazon Web Services that monitors the customer's applications and resources running on the AWS® infrastructure in real - time. It is used to track and to collect metrics, variables you can measure for your applications and resources. AWS® CloudWatch monitors resources like Amazon Elastic Compute Cloud (EC2®) instances, Elastic Load Balancing (ELB®), Amazon Elastic Block Store (EBS®) volumes, and Amazon Relational Database Service (RDS®) instances.

...

  • Login to AWS® Management Console and open the IAM console. Select Roles from the menu and then click the Create role button.



  • Select the service that will use this Role for the AWS® services (EC2, Lambda, and others). Select EC2 and click the Next: Permission button.



  • To select your new role's policy, search for the CloudWatchAgentServerPolicy, check the checkbox and click the Next button. 



  • Provide the Role Name, review, and create the Role.


Attaching the IAM Role

...

Run the following commands to connect to the EC2 instance. First, the CloudWatch Agent has to be installed from S3. The below command can be used, for example, to download for AMD64 Ubuntu.

...

To install the CloudWatch Agent on Windows, the below MSI installer file is executed:

...

The CloudWatch Agent makes use of a configuration file that, by default, is looked up from the below path:
If this file is unavailable from the below path, the user must create it manually.

Code Block
/opt/aws/amazon-cloudwatch-agent/bin/config.json


From the above path, users can create the configuration file with the following content:

...

The wizard automatically creates the config.json file having asked a number of questions related to collecting system-level metrics. When using the wizard, users can always use the generated configuration file and manually add it to any EC2 instances.

...

In the CloudWatch Overview, users can select Logs from the menu. Users find the label for the Log Group created in the configuration of Logs. Selecting the Log Group Name allows to see the Log Streams. Clicking the Log Stream specifies the EC2 instance from which data is logged.

Users can use the filter text box to search in logs.

Advantages of CloudWatch Logs

  • CloudWatch log provides real-time application and System Monitoring
  • Long-term log retention
  • Users can access all the data from a single dashboard.
  • CloudWatch can be used to set alarms and execute automatic actions.
  • Users can tune their AWS services to deliver the highest performance and throughput using the metric data and logs.