TwiceToldby Develoker
ConceptsSystem designLabsCheat sheetsAbout

Develoker makes free tools for learning to build software. TwiceTold explains each idea twice, as an everyday analogy and the real thing; CloudArch lets you design cloud systems and put load on them.

About ยท Labs ยท Cheat sheets ยท Learning paths

โ† Back to Amazon CloudWatch

๐Ÿš Amazon CloudWatch: cheat sheet

๐ŸŽจ The analogyA delivery van's dashboard: gauges, a trip log and warning lights that come on when a reading stays red.
๐ŸŽ“ The regular explanationAWS's monitoring service. It stores time-series metrics, evaluates alarms on them that notify or act, collects and queries logs, and draws dashboards, for AWS services and your own applications.
CloudWatch at a glanceStep 4 of 4
๐ŸŽ›๏ธ Dashboard๐ŸšDelivery vanโฒ๏ธGauges95%๐Ÿ““ Trip log3 lines๐ŸšจWarning lightALARM๐Ÿง‘You
  1. As the van drives, it keeps sending readings to its gauges, like engine heat once a minute.
  2. It also writes what happens into the trip log, line by line.
  3. The engine runs hot and stays hot. The warning light watching that gauge sees the reading stay past its red line, and comes on.
  4. The light gets your attention, and you open the trip log to find out why it's so hot.
Metrics, dimensions and statisticsStep 5 of 5
๐Ÿ› ๏ธ Engine panelEngine heat: van 140key 12:00: 40045key 12:01: 45142key 12:02: 42295key 12:03: 95341key 12:04: 4145Engine heat: van 270key 12:00: 70072key 12:01: 72171key 12:02: 71270key 12:03: 70373key 12:04: 7345๐ŸšVan 1๐ŸšVan 2๐Ÿง‘Youmax: 95
  1. Van 1 sends an engine heat reading every minute. Its gauge sits on the engine panel and is tagged "van 1".
  2. Van 2 sends the same kind of reading, but its tag says "van 2", so it gets a gauge of its own.
  3. Van 1 climbs a steep hill for one minute, then cools down again.
  4. You ask for the average heat over those five minutes. Van 1 looks calmer than van 2.
  5. Then you ask for the hottest reading instead. Now the hill shows up on van 1's gauge.
An alarm with 2 of 3 datapointsStep 6 of 6
Engine heat gauge55key 12:01: 55192key 12:02: 92261key 12:03: 61391key 12:04: 91452key 12:05: 52548key 12:06: 486โœ• โœ•๐Ÿ’ซVan 1๐ŸšจWarning lightno data๐Ÿ“ฑBoss's phone๐ŸญVan depot+1 van
  1. The light's red line is 80, and it comes on only if 2 of the last 3 readings are over it. Readings are normal, so the light is off.
  2. One hot reading on a hill. That's only 1 of the last 3, so the light stays off.
  3. A normal reading, then another hot one. Now 2 of the last 3 are over the line, so the light comes on.
  4. The light texts the boss and asks the depot to send another van out to share the deliveries.
  5. With help on the road, the engine cools. The light goes off and texts the boss that all is well.
  6. Then the van stops sending readings at all. After a few silent minutes the light turns grey, because it can't tell.
Log groups, metric filters and Logs InsightsStep 5 of 5
๐Ÿ“š Deliveries logbookkept 30 daysVan 1's pagesokkey INFO parcel 17 delivered: ok0okkey INFO parcel 18 delivered: ok1ERRkey ERROR flat tyre on route 9: ERROR234Van 2's pagesokkey INFO parcel 31 delivered: ok0ERRkey ERROR flat tyre on route 4: ERROR1234๐ŸšVan 1๐ŸšVan 2โฒ๏ธFlat tyre gauge2 problems๐Ÿง‘You2 found
  1. Each van writes lines on its own pages, and both vans' pages go into the deliveries logbook.
  2. Van 2 writes "flat tyre". The helper reading new lines spots it and nudges the flat tyre gauge up by one.
  3. More lines arrive, and van 1 gets a flat tyre too. The gauge goes up again.
  4. You ask the search helper which vans had a flat tyre this morning. It searches every page in the logbook and finds two lines.
  5. Finally, you tell the logbook to shred pages older than 30 days, so the shelf stops growing.
A dashboard runs its widgets' queriesStep 4 of 4
๐Ÿง‘You๐Ÿ—‚๏ธ Morning check cardlast 7 daysโฒ๏ธGauges๐ŸšจWarning lights๐Ÿ““ Trip log
  1. You slide the morning check card out of the glovebox. It lists what to show, but holds no readings itself.
  2. The card fetches the latest engine heat for every van, the warning lights, and the last flat-tyre lines from the trip log.
  3. The screen shows it all side by side, so you see in one look that everything is fine.
  4. You switch the screen to last week. The card fetches a week of readings and lines, and every picture redraws.
A Spring Boot app on EC2 reports to CloudWatchStep 4 of 4
๐ŸšVan 1๐ŸงฎMeter-readerback to 0๐Ÿง‘โ€๐Ÿ”งRide-along helpermemory 63%โฒ๏ธGaugestotal: 3๐Ÿ““ Trip log/app/orders
  1. Each time a parcel is delivered, the van's meter-reader adds one to its count. Nothing leaves the van yet.
  2. Once a minute the meter-reader sends one short summary to the dashboard, instead of one message per parcel.
  3. Meanwhile the van writes its trip log. The ride-along helper copies the new lines onto the dashboard's shelf.
  4. The helper also reads what the van's own gear can't see, like how full the cargo area is, and sends that to the gauges.

๐Ÿงฉ Key questions

The light's red line is 80 and it needs 2 of the last 3 readings over it. Readings come in as 90, 60, 70. Is the light on?
Off, because only 1 of the last 3 readings is over the line. The light waits for 2 bad readings out of 3, so a single hot minute on a hill doesn't set it off.
Van 1's engine got very hot for one minute, but the five-minute average looks calm. Which summary would have shown the hot minute?
The hottest reading in each stretch. An average smooths a short burst away. The hottest reading keeps it.
You fit a parcels gauge and tag every reading with the customer's name, so each customer gets their own gauge. Why is that a bad idea?
Every new name makes a new gauge, and each gauge costs money every month. Thousands of customers means thousands of gauges. Write the customer's name in the trip log instead.
You set up a helper to count every "flat tyre" line in the trip log, starting today. The log already has last month's flat tyres. What does the gauge show?
Only flat tyres written from today on. The helper only reads new lines as they're written. To count old ones, ask the search helper instead.