Stop 14 · Monitoring, Security & Cost OptimizationProjects · 1/1

Monitoring & Alerting Setup on AWS

Part of the AWS Roadmap

In short

An app nobody watches is an app that fails quietly at 3 a.m. Wiring up dashboards, sensible alerts and a runbook shows you think about day two, not just launch day.

A project that adds a CloudWatch dashboard, a few meaningful alarms routed through SNS, log retention and a short runbook to an app you already built, so problems are caught before users report them.

The blob character turns off a stove knob as a pressure cooker lets out a puff of steam.

Think of it like this

The cooker whistle

Nobody stands staring at the pressure cooker. You go do other things, and the whistle tells you when to act. Too few whistles and the dal burns. A whistle every ten seconds and you stop listening. Good alerts are like the right number of whistles.

Watch it happen

From error spike to your phone

Load balancer
CloudWatch
SNS topic
You (on-call)

5XX count: 37

1/6The load balancer publishes metrics every minute, including how many 5xx errors the app returned.

The big ideas

What you need to know

One clear dashboard

Requests, error rate, latency and saturation (CPU, memory, connections) on one screen for the app.

Alert on symptoms

Page on what users feel, like high errors or latency. CPU at 80% alone usually isn't worth waking up for.

Runbook per alert

Each alert links to a short page: what it means, first checks, how to fix, who to escalate to.

Test the alert

Trigger it on purpose, for example with a route that returns 500, and record that it fired.

See it in code

Walk through the code

bash
1aws sns create-topic --name oncall-alerts2aws sns subscribe --topic-arn "$TOPIC_ARN" \3  --protocol email --notification-endpoint you@example.com4 5aws cloudwatch put-metric-alarm --alarm-name web-5xx-high \6  --namespace AWS/ApplicationELB --metric-name HTTPCode_Target_5XX_Count \7  --dimensions Name=LoadBalancer,Value=app/web-alb/50dc6c495c0c9188 \8  --statistic Sum --period 300 --evaluation-periods 1 \9  --threshold 10 --comparison-operator GreaterThanThreshold \10  --treat-missing-data notBreaching \11  --alarm-actions "$TOPIC_ARN" --ok-actions "$TOPIC_ARN"

1/4Create a topic and subscribe your email. AWS sends a confirmation link first.

An SNS topic plus one alarm on app errors. Confirm the subscription email before testing, or nothing arrives.

Save yourself the pain

Common mistakes

Oops

Creating 40 alerts on day one, most of them on CPU and disk.

Do this instead

Start with three or four symptom alerts. Noisy alerts train everyone to ignore them.

Oops

Alerts that say only "ALARM: metric high" with no next step.

Do this instead

Name alerts clearly and link a runbook in the description.

Your mission

First milestone: one alert that fires

~40 min

Quick check

Which alert is most useful to page someone at night?

Go deeper

  1. 1Pick three alarms that matter, such as 5xx errors, high latency and unhealthy targets.
  2. 2Trigger each alarm on purpose and record the alert you receive.
  3. 3Write a runbook entry for each alarm saying what to check first.

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge