# Amazon CloudWatch

> The dashboard and alarm system that watches everything running in your AWS account.

- Level: Basic
- Topics: AWS
- URL: https://tidbit.legios.com.ar/amazon-cloudwatch/
- In Spanish: [Amazon CloudWatch](https://tidbit.legios.com.ar/es/amazon-cloudwatch/)

**CloudWatch** is the AWS service for monitoring. Almost every AWS service reports **metrics** to it on its own: CPU use of an Amazon EC2 instance, number of calls to an AWS Lambda function, free space in an Amazon RDS database, messages waiting in a queue. You see them as charts going back months, without installing anything.

Second piece: **logs**. Applications and services send their text output to CloudWatch Logs, where you can search it ('every line with `error` in the last hour') instead of logging into machines. Third piece: **alarms**. You write a rule such as 'CPU above 80% for five minutes' or 'more than ten errors a minute', and CloudWatch sends an email through Amazon SNS, pages the on-call person, or triggers an action like adding servers.

Why it matters: in the cloud you cannot walk over to a machine and look at it. CloudWatch is how you find out something broke, ideally before the users do. A team sets an alarm on a Lambda function's error count; at 2 a.m. it fires, the on-call engineer gets a text, and the fix goes in before the morning rush.

## An analogy

The dashboard of a car. Speed, fuel and engine temperature in one place, with a red light that comes on before the engine actually overheats.

## Keep in mind

- Metrics are numbers over time, logs are text, alarms act on either.
- Most AWS services send basic metrics for free; detailed metrics and logs cost per gigabyte.
- Alarms can notify people or trigger automatic actions like scaling.
- Dashboards put metrics from many services on one screen.

## Go deeper

- [What is Amazon CloudWatch? (official docs)](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html)
- [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/)

## Related terms

- [CPU](https://tidbit.legios.com.ar/cpu/): The chip that runs your programs, one instruction after another, very fast.
- [Amazon EC2](https://tidbit.legios.com.ar/amazon-ec2/): Virtual computers you rent by the hour, in any size, and switch off when done.
- [AWS Lambda](https://tidbit.legios.com.ar/aws-lambda/): Run a piece of code only when something happens, with no server to manage.
- [Amazon RDS](https://tidbit.legios.com.ar/amazon-rds/): A ready-made relational database that AWS keeps patched, backed up and running.
- [Database](https://tidbit.legios.com.ar/database/): An organized store of data that programs can search and update safely.
- [Amazon SNS](https://tidbit.legios.com.ar/amazon-sns/): One message in, many copies out: a megaphone for systems.
- [Server](https://tidbit.legios.com.ar/server/): A computer whose job is to answer requests from other computers, all day, every day.
- [Cloud computing](https://tidbit.legios.com.ar/cloud-computing/): Renting computers over the internet instead of buying your own.
