AWS CloudWatch and CloudTrail are both services used for showing the real-time monitoring, metrics alarms, events, and logs of your instances, application, and Infrastructure.
What is AWS CloudWatch?
Amazon Cloud Watch is a service from Amazon Web Services that provides real-time monitoring of custom applications running on AWS resources, virtual machines, and Amazon infrastructure.
You can check the performance of your applications through graphical analysis. You can set your price once you start your application. If your application is working properly or some machines are not needed, you can remove some machines; now, your price will be lower. If your application is causing some problems and more machines are required, you can add more machines for your application, and now your cost will be higher. You can also set Error and Troubleshooting through the monitoring.
AWS provides real-time monitoring of AWS resources and custom applications.
Two types of AWS CloudWatch are as follows:
- Basic monitoring
- Detailed monitoring
1. Basic monitoring it free polls every 5 min very few metrics.
2. Detailed monitoring it charges polls every 1 min wide range metrics.
Resources Monitored by CloudWatch:
- Virtual Machine (EC2)
- Database (AWS RDS)
- Data stored in Amazon (S3)
- Elastic Load Balancer
- Other AWS Services
Why do you need AWS CloudWatch?
Provides a standard monitoring list that you can use to analyze monitor system performance. Reduce unnecessary operating costs by sending notifications in case of unreasonable cost issues. Find out the problems early to avoid disasters. It also prevents and reduces downtime and business losses. Monitor the end-user experience and create reports that help improve.
What does Amazon CloudWatch do?
- Collect Key and track key metrics
- Create alarm and send notifications
- Collect, monitor, and store log files
- Sends system Events from AWS resources to AWS Lambda, SNS, etc.
Concepts of CloudWatch
1. AWS CloudWatch Metrics
A metrics represents a set of data points in time order published on CloudWatch. Think of a variable to monitor, and the data points represent the values of that variable over time.
It is a name/value pair that uniquely identifies a metric. They can be thought of as a category of features that define a metric. We can assign ten dimensions per metric.
3. Amazon CloudWatch Statistic
Statistics metrics data are collected over a specific period. Methods of submission are within time using namespace, metric name, dimensions.
4. AWS CloudWatch Alarm
You can use an alarm to start automatically. It looks at a metric during a specific period and performs one or more specific actions.
Events of AWS CloudWatch
The Amazon Cloud Watch event is part of the Amazon Cloud Watch, which provides a ‘real-time stream close to system events’ that allows you to ‘monitor and responds to charges in your resources’ in the name of laws that lead events to one or more targets.
Three types of Events are as follows:
An event indicates a change in your environment. AW resources generate events when their condition changes. Represent small JSON blobs.
Review upcoming events to see if there is a limit or out-of-bounds scenario. If so, the event has been targeted.
A target deals with events that go beyond a rule. A rule can call for multiple targets.
Use Case of AWS CloudWatch
Create a system that closely replicates dynamic DNS behavior. Update Amazon Route 53 records when the Amazon EC2 instance changes its status. Use the services of Amazon Cloud Watch, Route 53, and AWS Lambda.
What is AWS CloudTrail?
AWS CloudTrail is a service of AWS that helps you work compliance, operational, and risk audits of your AWS account. Actions by a user, role, or AWS service are recorded as events in the CloudTrail. The AWS Management Console, the AWS Command-Line Interface, and the APIs included in the event.
Amazon CloudWatch Logs are used to monitor, store and access log files from AWS resources. CloudWatch stores files of Amazon EC2 instances, Amazon CloudTrail, Route 53, and others.
Feature of CloudWatch logs
- Amazon EC2
- Log Retention
- Log Storage
- DNS Queries
1. Amazon EC2
In real-time, Amazon monitors logs from EC2 instances.
2. Log Retention
Adjusts the retention period from 10 years to one day.
3. Log storage
A cloud watch log allows storing your log data in highly durable storage.
4. DNS Queries
DNS logs information about queries that Route 53 receives.
Events of AWS Cloud trail
Some of the concepts that are central to understanding Amazon Cloud Watch Logs.
Three types of Logs Events are as follows:
The log is a record of activity through event resources or applications.
2. Log stream
Log stream is a sequence of log events that share the same data.
3. Log group
A log group represents groups of log streams, which share identical monitoring and access control.