What it does
Cost Explorer can answer "what did we spend yesterday", but it takes a few clicks, a date picker and a group-by every time, and the default view is the month. So most teams look at AWS cost once, when the invoice arrives.
The agent makes one Cost Explorer call each morning for the last 30 days by service, and turns it into one number for yesterday, the average it should be compared with, and the service that moved. It leaves out credits and refunds so a promotional credit does not hide a real increase.
How it works
1Pull 30 days by service
aws ce get-cost-and-usage --time-period Start=<30 days ago>,End=<today> --granularity DAILY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICE.Endis exclusive, so this ends with yesterday. Each request costs $0.01.- 2
2Leave out credits, refunds and tax
Add
--filter '{"Not":{"Dimensions":{"Key":"RECORD_TYPE","Values":["Credit","Refund","Tax"]}}}'so the daily line shows usage, not the timing of a credit. - 3
3Compare yesterday
Sum yesterday across services and compare with the average of the 7 days before it and with the same weekday last week. Rank services by cost and by change; a service up 30% and $25 or more is worth naming.
4Add the month
Sum month to date from the same data, and if you want the projection, one
aws ce get-cost-forecast --time-period Start=<today>,End=<first of next month> --metric UNBLENDED_COST --granularity MONTHLYcall for the rest of the month.- 5
5Report
Yesterday's total, the change against the 7-day average, the top five services with their change, month to date, and the forecast if requested.
Post it to the board
With
BRIEFKIN_TOKENset, the agent sends the result as one card that updates in place every run. Without it, you get the report in the chat.
Install and run it
Pick your agent, where the data comes from and how to schedule it; the commands below follow.
Install the skill
One command. It puts the SKILL.md in ~/.claude/skills and in ~/.agents/skills, which Codex, Cursor, Gemini CLI, Copilot CLI and OpenCode read too.
shell
curl -fsSL https://briefkin.dev/skills/aws-daily-cost-report/install | shRun it
Ask Claude Code:
prompt
Run the aws-daily-cost-report skillOr paste the prompt instead of installing:
prompt
Using the AWS CLI or the AWS Billing and Cost Management MCP server (read only), call Cost Explorer get-cost-and-usage for the last 30 days, DAILY granularity, UnblendedCost, grouped by SERVICE, with a filter that excludes RECORD_TYPE Credit, Refund and Tax. Tell me yesterday's total, its change against the average of the 7 days before and against the same weekday last week, the top five services with their change, and any service that rose 30% and at least $25, with the usage type behind it if you can find it. Add month-to-date spend. Keep it to one Cost Explorer call unless I ask for a forecast, since each request costs $0.01.Put it on a schedule
Every day at 8:00, from cron on any machine where Claude Code is signed in:
crontab
0 8 * * * claude -p "Run the aws-daily-cost-report skill"Add it with
crontab -e. A laptop asleep at that time runs it when it wakes if you use launchd or Task Scheduler instead; GitHub Actions works for the API route.Send it to your board
Connect Briefkin once with
curl -fsSL https://briefkin.dev/install | shand every run lands on your board as a stat tile. How setup works
View the SKILL.mdRaw file
SKILL.md---
name: aws-daily-cost-report
description: "Every morning: what AWS cost yesterday, against the 7-day average, with the top services, the one that moved and month-to-date spend. Use when the user asks for this, or when it runs on a schedule."
---
# AWS daily cost report
Every morning: what AWS cost yesterday, against the 7-day average, with the top services, the one that moved and month-to-date spend.
Cost Explorer can answer "what did we spend yesterday", but it takes a few clicks, a date picker and a group-by every time, and the default view is the month. So most teams look at AWS cost once, when the invoice arrives.
The agent makes one Cost Explorer call each morning for the last 30 days by service, and turns it into one number for yesterday, the average it should be compared with, and the service that moved. It leaves out credits and refunds so a promotional credit does not hide a real increase.
## Two ways to get the data
Use the API or MCP route when you have an MCP server, a CLI or an API token for the app. Otherwise, if you can drive a browser the user is signed in to (Claude in Chrome, a Playwright or Chrome DevTools MCP server), use the browser route. Say which one you used.
## Route A: API or MCP server
### What you need
- AWS credentials for the management (payer) account, or a member account, allowed `ce:GetCostAndUsage` and, for the projection, `ce:GetCostForecast`.
- Or the AWS Billing and Cost Management MCP server (`awslabs.billing-cost-management-mcp-server`), which wraps the same Cost Explorer calls.
If something is missing, say what and stop; do not invent numbers.
### Steps
1. **Pull 30 days by service** (AWS): `aws ce get-cost-and-usage --time-period Start=<30 days ago>,End=<today> --granularity DAILY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICE`. `End` is exclusive, so this ends with yesterday. Each request costs $0.01.
2. **Leave out credits, refunds and tax**: Add `--filter '{"Not":{"Dimensions":{"Key":"RECORD_TYPE","Values":["Credit","Refund","Tax"]}}}'` so the daily line shows usage, not the timing of a credit.
3. **Compare yesterday**: Sum yesterday across services and compare with the average of the 7 days before it and with the same weekday last week. Rank services by cost and by change; a service up 30% and $25 or more is worth naming.
4. **Add the month** (AWS): Sum month to date from the same data, and if you want the projection, one `aws ce get-cost-forecast --time-period Start=<today>,End=<first of next month> --metric UNBLENDED_COST --granularity MONTHLY` call for the rest of the month.
5. **Report**: Yesterday's total, the change against the 7-day average, the top five services with their change, month to date, and the forecast if requested.
## Route B: the browser
### What you need
- Signed in to the AWS console with an IAM user or role that has Cost Explorer access (`ce:GetCostAndUsage` through the `AWSBillingReadOnlyAccess` policy or similar), and Cost Explorer enabled on the account.
- In a member account you only see that account's cost unless the payer has shared it.
If something is missing, say what and stop; do not invent numbers.
### Steps
Start at https://console.aws.amazon.com/costmanagement/home#/cost-explorer. The user is signed in already; never type passwords or codes, and ask if a sign-in page appears.
1. **Open Cost Explorer in the payer account**: Sign in to the management (payer) account if you want every member account, otherwise the one account you care about. The link opens Billing and Cost Management > Cost Explorer; if it shows the saved report list, click **New cost and usage report**.
2. **Set the range and grouping**: In the right-hand panel set **Date Range** to a custom range from 30 days ago to yesterday, **Granularity** to `Daily` and **Group by** Dimension to `Service`. The chart turns into one bar per day with a table below it.
3. **Exclude credits, refunds and tax**: Under **Filters**, open **Charge type**, choose `Credit`, `Refund` and `Tax`, and switch the filter to **Exclude**. The table caps the number of services and puts the rest in "Others", so click **Download as CSV** to get every service per day.
4. **Read yesterday against the week**: From the CSV, total yesterday, the average of the 7 days before it and the same weekday last week. Rank services by yesterday's cost and by change; name any service up 30% and $25 or more.
5. **Add the month**: Change **Date Range** to the `Month to date` preset for the total so far. Extending the end date to the last day of the month adds AWS's own forecast as a hatched bar, if you want the projection.
Note: Cost Explorer data refreshes a few times a day, so an early-morning look at yesterday can still grow by a few percent. Each Cost Explorer page load also runs API requests billed at $0.01 each. The on-screen table shows a limited number of groups; the CSV has them all.
## The report
- **Yesterday's spend**, against the 7-day average and the same weekday last week.
- **Top services** by cost with their change.
- **What moved**: the service and usage type behind any jump.
- **Month to date**, and the forecast for the month if asked.
## Post it to Briefkin
When `BRIEFKIN_TOKEN` is set, or `~/.config/briefkin/env` exists (the installer from https://briefkin.dev/docs writes it), also send the result to the user's Briefkin board as one card. Keep the `item_key` the same on every run so the card updates in place, use a new `event_id` per run, and put today's real numbers in place of the example ones. If the request fails, say so once and carry on.
```bash
[ -n "${BRIEFKIN_TOKEN:-}" ] || . ~/.config/briefkin/env
curl -sS -X POST "${BRIEFKIN_URL:-https://briefkin.dev}/v1/events" \
-H "authorization: Bearer $BRIEFKIN_TOKEN" \
-H "content-type: application/json" \
-d @- <<'JSON'
{
"v": 1,
"event_id": "aws-daily-cost-report/<date of this run, e.g. 2026-10-16>",
"item_key": "aws-daily-cost-report",
"project": "Acme AWS",
"source": "AWS daily cost report skill",
"kind": "metric",
"title": "Yesterday cost $1,284, 10% above the 7-day average",
"metric": {
"label": "AWS spend yesterday",
"value": 1284.37,
"prefix": "$",
"better": "lower",
"period_start": "<start of the period, ISO 8601>",
"period_end": "<end of the period, ISO 8601>"
},
"glance": [
{
"type": "Grid",
"props": {
"columns": 3
},
"children": [
{
"type": "Stat",
"props": {
"label": "7-day average",
"value": 1166,
"prefix": "$"
}
},
{
"type": "Stat",
"props": {
"label": "Month to date",
"value": 18642,
"prefix": "$"
}
},
{
"type": "Stat",
"props": {
"label": "Top service",
"value": "EC2"
}
}
]
}
],
"widget": [
{
"type": "Table",
"props": {
"columns": [
"Service",
"Yesterday",
"vs 7-day avg"
],
"align": [
"left",
"right",
"right"
],
"rows": [
[
"Amazon EC2",
"$512.40",
"+4%"
],
[
"Amazon RDS",
"$268.10",
"+1%"
],
[
"Amazon S3",
"$141.85",
"+3%"
],
[
"Amazon CloudWatch",
"$96.20",
"+48%"
],
[
"Data transfer",
"$88.30",
"+2%"
],
[
"Everything else",
"$177.52",
"+5%"
]
]
}
},
{
"type": "Callout",
"props": {
"text": "CloudWatch went from about $65 to $96 a day after new log groups appeared in acme-prod on Oct 15. The usage type is log ingestion.",
"tone": "warn"
}
}
],
"size": "md"
}
JSON
```
Widgets come from the Briefkin catalog (https://briefkin.dev/v1/catalog). Without a token, just give the user the report.
Set `period_start` and `period_end` to the window the number covers: the tile names it from them ("Last 7 days", "Today", "This month"). For a count right now (open items, a balance), send `"period_label": ""` so no period shows; for another name, send it as `period_label` (at most 24 characters).
## Run it on a schedule
Suggested: Every day at 8:00 (`0 8 * * *`). From cron, with the agent signed in on that machine:
```bash
0 8 * * * claude -p "Run the aws-daily-cost-report skill"
# Codex: codex exec, Gemini CLI: gemini -p, Copilot CLI: copilot -p, OpenCode: opencode run
```
Or use the agent's own scheduler (Claude Code routines, Codex automations, Claude or ChatGPT scheduled tasks): https://briefkin.dev/skills/aws-daily-cost-report#schedule
Source: https://briefkin.dev/skills/aws-daily-cost-report
What your agent needs
AWS credentials for the management (payer) account, or a member account, allowed
ce:GetCostAndUsageand, for the projection,ce:GetCostForecast.Or the AWS Billing and Cost Management MCP server (
awslabs.billing-cost-management-mcp-server), which wraps the same Cost Explorer calls.
Connecting AWS
- AWS MCP Server, AWS's managed remote server, at
https://aws-mcp.us-east-1.api.aws/mcp(other Regions follow the same pattern, such asaws-mcp.eu-west-1.api.aws). In Claude Code, runclaude mcp add aws-mcp https://aws-mcp.us-east-1.api.aws/mcp --transport httpand sign in through AWS Sign-in; your IAM user or role needs theAWSMCPSignInOAuthAccessPolicymanaged policy for that step. Cursor takes the URL with?oauth=initializeappended, and Codex usescodex mcp add aws-mcp --url https://aws-mcp.us-east-1.api.aws/mcp?oauth=initialize(setup). - The same server through the MCP Proxy for AWS. With credentials from
aws loginor an SSO profile, run it asuvx mcp-proxy-for-aws-cli@latest https://aws-mcp.us-east-1.api.aws/mcp --read-only. The proxy signs each request with SigV4, and--read-onlyhides the tools that may need write permissions. AWS also publishes an open-source Billing and Cost Management MCP server (uvx awslabs.billing-cost-management-mcp-server@latest) focused on Cost Explorer, budgets, anomalies and Savings Plans. - AWS CLI or SDK.
aws ce get-cost-and-usage --time-period Start=2026-10-01,End=2026-10-16 --granularity DAILY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICEreturns the same data. The skill readsAWS_PROFILEandAWS_REGION; Cost Explorer itself is served fromus-east-1.
Run reports under a role that can only read billing data, for example one allowed ce:GetCostAndUsage, ce:GetCostForecast, ce:GetAnomalies and budgets:ViewBudget, or the AWSBillingReadOnlyAccess managed policy: the MCP server can do no more than that role allows.
Questions
Can yesterday's number still change?
Yes, a little. Cost Explorer data refreshes during the day and some services report usage late, so a day can grow by a few percent after the first look. The card compares like with like (each morning's view of the day before), which keeps the trend honest.
Unblended or amortized cost?
Unblended is what was charged that day, so a yearly Savings Plan or reserved instance shows up as one large spike. If you have upfront commitments, ask for AmortizedCost instead and the fee is spread across the term, which makes the daily line smoother.
Do I need Briefkin to use the AWS daily cost report skill?
No. The skill runs with your own agent and gives you the report in the chat. With a Briefkin token set, each run also posts it to your board as a stat tile, so you can glance at it instead of asking again.
Which agents can run it?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot CLI, OpenCode, Windsurf and Amp all read SKILL.md files. The install command puts it in ~/.claude/skills and ~/.agents/skills, where they look. ChatGPT, the Claude app and Grok take the prompt instead. Pick your agent under "Install and run it" and the commands change to match.
Can it work without an API or MCP server, from my browser?
Yes. Switch the data source to "Your browser" and the steps change to the AWS pages themselves: the agent opens console.aws.amazon.com/costmanagement/home#/cost-explorer in a browser you are signed in to and reads the numbers off the page. Claude Code, Codex, Cursor, Claude app and ChatGPT can drive a browser out of the box; Gemini CLI, Copilot CLI and OpenCode need a Playwright or Chrome DevTools MCP server first. It is slower than the API and needs you signed in, so it suits a report you run by hand or from a scheduler on your own computer.