
Weekend Agent Challenge: Ops Brief Agent
A scheduled Lambda collects verified AWS account facts, diffs them against yesterday, and delivers a grounded AI brief by email. No clicks.
Vision & What the Agent Does
I build on AWS, and I pay the bill myself. Every morning starts with the same two questions: did anything change in my account overnight, and is anything costing money it shouldn't?
Ops Brief Agent answers both before I wake up.
At 7:00 AM Central, EventBridge Scheduler invokes a Lambda function. No button, no dashboard, no prompt. The function collects three verified facts from my account:
- CloudWatch alarms currently in ALARM state
- Running EC2 instances, flagging anything untagged
- Yesterday's spend by service from Cost Explorer
Then it does the part that makes it an agent instead of a cron job. It loads the previous run from DynamoDB and computes what changed: new alarms, resolved alarms, new or terminated instances, and the spend delta since yesterday.
Only then does AI enter the picture. The signals and the diff go to Amazon Nova 2 Lite through the Bedrock Converse API with one job: write a short brief, lead with what changed, and never state a number that is not in the JSON it was handed. The brief lands in my inbox as a rendered HTML email through SES. The agent stores the run and goes back to sleep.
The design rule that shaped everything: facts are collected in code, and the model only writes the narrative around numbers it was given. The counts can be wrong only if my boto3 calls are wrong. Never because a model guessed.
A stateless script can tell you what exists. This one tells you what changed.

How You Built It
Everything is Terraform. Every resource was hand-typed as HCL and deployed with terraform plan and apply. I have written before that a successful terraform apply is not the same as a correct infrastructure design. This build kept proving the point, four times.
- Syntax validation is not semantic correctness. The instructive bug was dyanmodb:Query, a transposed service prefix. It applied cleanly, sat in a valid-looking policy, and produced AccessDenied at runtime with nothing pointing at the typo. terraform validate catches malformed HCL. It does not catch a correctly formatted string naming a service that does not exist. Least-privilege policies live or die at that second layer.
- Nova 2 Lite invokes through a cross-region inference profile, not a bare model ID. IAM has to allow both the profile ARN and the underlying foundation model ARNs it routes to. Allowing only the profile still gets AccessDenied, while the console shows the permission you think you granted.
- SES sending and inbox trust are different problems. My first brief landed in Gmail spam. The code was fine. But mail claiming a gmail.com sender while originating from Amazon's servers fails SPF and DKIM alignment. Production fix is a verified domain with DKIM. Weekend fix is marking it not spam.
- Not every red error is a bug. After deploying, the Lambda console showed ResourceNotFoundException for the log group. Lambda creates its log group lazily on first invocation, which is exactly why the policy grants logs:CreateLogGroup. First test, errors gone.
The decision I'm most proud of is keeping the model out of the layout. Nova writes one narrative paragraph. Every table, count, and dollar figure in the HTML email is rendered in Python from the collected signals, with a plain-text part alongside for deliverability. The footer of every brief says so, because the grounding guarantee is the product.
AWS Services Used / Architecture Overview
EventBridge Scheduler (cron, 7:00 AM America/Chicago) invokes Lambda (Python 3.12). Lambda collects from CloudWatch, EC2, and Cost Explorer, reads and writes run state in DynamoDB, sends the signals and diff to Bedrock (Nova 2 Lite via the us. cross-region inference profile), renders the HTML brief, and delivers through SES.

Decisions worth defending:
IAM is scoped to resource ARNs everywhere the API allows it. Bedrock InvokeModel is scoped to the inference profile and foundation model ARNs. DynamoDB actions are scoped to the one table. SES is scoped to the one identity. The read APIs (DescribeAlarms, DescribeInstances, GetCostAndUsage) are Resource: * because those actions do not support resource-level permissions. Knowing which wildcard is a choice and which is the API is the difference between least privilege and least effort.
EventBridge Scheduler is not the legacy rules pattern. Scheduler invokes Lambda by assuming its own execution role, so the build needs a second IAM role trusting scheduler.amazonaws.com rather than a resource-based Lambda permission.
Terraform state is local for this build. Production would be an S3 backend with locking. That is a documented scoping decision, not an accident.
Cost, actual:
Item | Cost |
|---|---|
Lambda (1 run/day, ~2.5s billed, 256 MB) | Free tier |
EventBridge Scheduler | Free tier |
DynamoDB on-demand (1 read + 1 write/day) | Effectively $0 |
SES (30 emails/month) | Effectively $0 |
Bedrock Nova 2 Lite (317 in / 98 out tokens on the first autonomous run) | Under a cent per month |
Cost Explorer API ($0.01 per request, 1/day) | $0.30/month |
The most expensive component of this AI agent is the API call that checks what everything else costs. That amused me enough to keep it. This morning's autonomous run confirmed it in the brief's own spend table: Cost Explorer $0.0200 for the day, Bedrock $0.0079.
What You Learned
The gap between "it applied" and "it is correct" is where the real work lives. terraform validate, a clean plan, and a green apply all passed with a policy that would have failed at runtime.
Email deliverability is its own discipline. SES sandbox plus a verified address gets mail sent. SPF and DKIM alignment decides whether it gets read.
Grounding was the highest-leverage design decision. Everything numeric is computed in code. The model formats and prioritizes. If I trusted the model to count instances, I would have built a confident liar.
What v2 looks like: dated run history in DynamoDB instead of a single latest item (the schema already supports it), event-driven triggers on GuardDuty findings and cost anomalies alongside the schedule, a dead-letter queue and alarm on the Lambda so the agent that watches things is itself watched, a verified sending domain with DKIM, S3 remote state, and CI applying reviewed plan artifacts instead of my terminal.
First autonomous run: July 19, 2026, 7:00:11 AM Central. The schedule fired eleven seconds after the cron, the agent collected, diffed, wrote, and delivered in 2.5 seconds, and the brief was waiting in my inbox when I woke up. It reported a spend decrease of $0.0275 against the previous run, computed from its own memory. Build time: one Saturday.
The takeaway I keep coming back to: a useful AI agent is not the one that writes the best paragraph. It is the one that cannot lie to you about your infrastructure.
Link to Repo
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article