Section 4 · Building Something Real
Observe with CloudWatch, Review with Well-Architected
13 min3 min readFill in the blanks
Lesson at a glance
Watch Lantern in production with CloudWatch metrics, logs and alarms, then review the whole design against the six Well-Architected pillars with cost optimisation in mind.
- 1Metrics: what is happening
- 2Logs: why it happened
- 3Alarms: tell a human
- 4The Well-Architected review
- 5Cost optimisation as a habit
No video here — just the real thing: a written lesson, runnable examples, a quiz and practice.
Lantern is live: the site on CloudFront, RSVPs on Lambda and DynamoDB, events in RDS. On the old server, “monitoring” meant a volunteer noticing that the site was down. This lesson gives Lantern eyes, with Amazon CloudWatch, and then steps back to review the whole design with the AWS Well-Architected Framework.
Metrics: what is happening
AWS services publish metrics to CloudWatch automatically. Each lives in a namespace and has dimensions, such as AWS/Lambda with FunctionName=lantern-rsvp. The handful that matter most for Lantern:
| Service | Metric | Tells you |
|---|---|---|
| Lambda | Errors, Throttles, Duration |
Failures, capacity limits hit, slowness |
| API Gateway | 5xx, 4xx, Latency |
What users actually experienced |
| DynamoDB | ThrottledRequests |
Requests the table refused |
| CloudFront | 5xxErrorRate, CacheHitRate (an additional metric you turn on) |
Edge health and how well caching works |
Logs: why it happened
Anything a Lambda function writes to stdout lands in CloudWatch Logs, in the log group /aws/lambda/lantern-rsvp. Switch the function’s log format to JSON in its logging configuration, log objects rather than sentences, and you can query them later with CloudWatch Logs Insights:
fields @timestamp, level, message, eventId
| filter level = "ERROR"
| sort @timestamp desc
| limit 20aws logs put-retention-policy \
--log-group-name /aws/lambda/lantern-rsvp --retention-in-days 30Alarms: tell a human
A metric nobody looks at is trivia. An alarm watches one metric against a threshold and changes state when it is crossed, notifying an Amazon SNS topic that emails the maintainers:
aws cloudwatch put-metric-alarm --alarm-name lantern-rsvp-errors \
--namespace AWS/Lambda --metric-name Errors \
--dimensions Name=FunctionName,Value=lantern-rsvp \
--statistic Sum --period 300 --evaluation-periods 1 \
--threshold 5 --comparison-operator GreaterThanOrEqualToThreshold \
--treat-missing-data notBreaching \
--alarm-actions arn:aws:sns:eu-west-1:111122223333:lantern-alertsFive errors in five minutes pages someone; an idle night, with no data at all, does not. Lantern starts with three alarms: Lambda errors, API Gateway 5xx responses, and DynamoDB throttles. Fewer, meaningful alarms beat many noisy ones that people learn to ignore.
The Well-Architected review
The AWS Well-Architected Framework is AWS’s checklist of design questions, grouped into six pillars. The free AWS Well-Architected Tool in the console walks you through them. Here is Lantern’s first review, one finding per pillar:
| Pillar | Lantern finding | Action |
|---|---|---|
| Operational excellence | Deploys are a sequence of manual commands | Script them; then infrastructure as code |
| Security | One volunteer still uses an IAM user | Move everyone to IAM Identity Center |
| Reliability | RDS is Multi-AZ; RSVP table has no point-in-time recovery | Turn PITR on |
| Performance efficiency | RSVP function at 128 MB takes 900 ms | Test 512 MB; often faster and similar cost |
| Cost optimization | Migration EC2 instance idle since cut-over | Snapshot and terminate it |
| Sustainability | Function runs on x86 | Switch to arm64 (Graviton) |
Cost optimisation as a habit
Cost runs through every lesson in this course; here it is as a checklist to run on every account:
- Delete what is idle. Old instances, unattached EBS volumes, unused Elastic IPs, forgotten NAT gateways.
- Right-size. Use metrics, not guesses, to choose instance and function sizes.
- Use the right pricing model. Savings Plans for the steady baseline, Spot for interruptible batch, serverless for spiky work.
- Let data age out. S3 lifecycle rules and log retention periods.
- Keep traffic local. Gateway endpoints for S3 and DynamoDB; CloudFront in front of anything public.
- Tag and look. Tag every resource
project=lantern, activate the tag for cost allocation, and open AWS Cost Explorer monthly. Your budget alert from lesson three is the safety net, not the plan.
That is the whole move. Lantern went from one fragile server to a set of managed pieces, each with an owner, a permission boundary, an alarm and a price you can explain. You can now set up an account safely, read and write IAM policies, pick the right core services, and ship and run a real workload, with cost and security designed in rather than bolted on.
Key takeaways
- CloudWatch collects metrics, logs and alarms for AWS services automatically; Lambda writes to the /aws/lambda/
log group. - An alarm watches one metric against a threshold and notifies an Amazon SNS topic, which emails the people who can act.
- New log groups keep data forever by default, so set a retention period on every log group to cap storage costs.
- The Well-Architected Framework has six pillars, namely operational excellence, security, reliability, performance efficiency, cost optimization and sustainability.
- Cost optimisation is a habit of deleting idle resources, right-sizing, using the right pricing model and tagging so you can see what each thing costs.