AWS CloudWatch is Amazon’s monitoring service which provides logging and alarm functionalities and used with almost every AWS service available.
Monitoring helps us drive to improvements of the experience for our stakeholders and architecture.
CloudWatch monitors AWS resources using matrices, alarms and alerts. Using the matrices, you can have alarms fire (e.g. CPU utilization is at 85%).
AWS CloudWatch provides metrics about your various AWS resources and allows you to monitor the performance and health of your applications. It collects data from your cloud resources in the form of logs or events and creates visualizations of these metrics so that you can see how all your resources are performing.
CloudWatch has a lot of features and use cases, however, our focus will be application logs and we will see how CloudWatch can help us with our application logging and monitoring.
I will be using .NET Core and NodeJS code samples for the demos, but principals are the same if you use Java, Python or other supported languages/run-times. Also focus will be on the application side, rather than infrastructure.
CloudWatch is integrated with many AWS Services. Following are few of the key services
- SNS messages (email, SMS, lambda execution etc.)
- EC2 autoscaling
- CloudTrail (API calls to AWS account, you can setup CloudWatch alerts)
- IAM: can control who can use CloudWatch.
- IAM: can use CloudTrail to monitor when requests are made to service using IAM credentials.
- Lambda (e.g. Run functions based on alerts).
CloudWatch has a lot of features, you can find more detailed and up to date information on official AWS Website on this link.
Each AWS service has CloudWatch metrics that you can use. They are typically defined as basic metric. Each metric is a set of data points published to CloudWatch over a period of time that you decide upon.