How to install and configure the CloudWatch logs agent on a EC2 Ubuntu linux server instance?

by XDK 16. August 2019 20:58

Steps:

 1. Create and Attach an IAM role with "CloudWatchFullAccess" policy to the EC2 instance as follows

  • Open the IAM console --> Create Role --> apply.
  • Attach the created Role to the EC2 instance.

2. To install and configure CloudWatch Logs on an existing Ubuntu Server instance

  • Connect to the EC2 instance,
  • On EC2 instance, run the following commands before installing CloudWatch Log

         sudo apt update
         sudo apt install python3

  • To install and configure CloudWatch Logs directly from the internet

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

  • Run the following command to setup system and custom application logs

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

  • awslogs.conf file content located at /var/awslogs/etc/

  • Use the following command to view the awslogs.log file

        sudo tail -f /var/log/awslogs.log

  • Navigate to Cloudwatch --> Log Groups to view the applogs and syslog log entries create by Cloudwatch agent.

  • Use the following commands to start,stop and get the status of agent service.

        sudo service awslogs start
        sudo service awslogs stop
        sudo service awslogs status

Tags:

Amazon Web Service

What is the CloudWatch retention period of all metrics?

by XDK 16. August 2019 08:13

Information:

CloudWatch retains metric data as follows:

1. Data points with a period of less than 60 seconds are available for 3 hours. These data points are high-resolution custom metrics.
2. Data points with a period of 60 seconds (1 minute) are available for 15 days
3. Data points with a period of 300 seconds (5 minute) are available for 63 days
4. Data points with a period of 3600 seconds (1 hour) are available for 455 days (15 months)

CloudWatch does not support metric deletion. Metrics expire based on the retention schedules described above.

 More...

Tags:

Amazon Web Service

About the author

My name is Xavier Dilip Kumar Jayaraj having 16+ years of IT experience which includes solid experience and depth Knowledge in Application Life Cycle Management, Configuration Management, Implementation and Support using TFS on-premises and Azure DevOps. I have invested in gaining DevOps knowledege to expertise with Cloud Computing providers namely Microsoft Azure and Amazon Web Services in recent years. I am very positive to learn and adapt emerging technologies to client’s environment.

Microsoft Certified: Azure Administrator Associate

Microsoft Certified: Azure DevOps Engineer Expert

DevOps Engineer Certificate Program | Transcript 

OTP-AWSD5: AWS IoT: Developing and Deploying an Internet of Things

[PCEP-30-01] PCEP – Certified Entry-Level Python Programmer

Quotes I Like

"Failure will never overtake me if my determination to succeed is strong enough."  - Dr. APJ. Abdul Kalam

"Always be yourself, express yourself, have faith in yourself, do not go out and look for a successful personality and duplicate it." - Bruce Lee

"Technology is just a tool. In terms of getting the kids working together and motivating them, the teacher is the most important." - Bill Gates

"Innovation distinguishes between a leader and a follower." - Steve Jobs

CategoryList

Disclaimer

The information provided here is based on my expreriences, troubleshooting and online/offline findings. It can be used as is on your own risk without any warranties and I impose no rights.