Daily
Catch AWS spend spikes in Slack
Slack warns you when a day's spend jumps well above the recent average.
- Runs
- Daily
- Apps
- AWS
- AI
- Not needed
- Access
- ce:GetCostAndUsage
Send this to your assistant
Create a ClickRuntime automation: every morning, compare yesterday's AWS spend with the 7-day average and alert #ops in Slack if it's more than 50% higher.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Monthly budgets in AWS are a blunt instrument. By the time an alert fires because you crossed eighty percent of the month's budget, the damage is done and the spike may have been going on for two weeks. A crypto-mining script on a compromised key, a load test left running or a misconfigured autoscaling group can add thousands of dollars within days, and a daily-average comparison would have caught it on day one.
Each day, ClickRuntime fetches the last eight days of AWS cost, averages the seven days before yesterday and compares yesterday against that average. If yesterday is well above normal, it sends a notification with the amount, the average and the services responsible.
Companies with variable workloads, such as data pipelines and batch jobs, especially benefit from a baseline that moves with their usage. It also works for teams that cannot predict a fixed monthly budget.
What you get out of it
Compromised credentials are caught fast
A leaked access key used to start expensive instances shows up as an abrupt jump. Finding it within a day limits the bill and lets you rotate keys before real damage occurs.
The baseline adapts to your normal
Comparing with a recent average means a steadily growing company does not trigger alarms every day. Only departures from the recent pattern produce a notification. Only real departures from your recent pattern ever reach your inbox today.
Misconfigured autoscaling is noticed
An autoscaling group stuck at maximum capacity can double compute spend overnight. The next morning's alert makes the problem obvious while the fix is a single setting. The fix is often one setting, changed the next morning.
Experiments do not become surprise costs
Load tests and data migrations are often forgotten after they finish. An alert tells you something is still running, so you turn it off before it becomes a line on next month's bill.
Refund requests have better evidence
If a spike was caused by an AWS error, a dated notification with the figures supports a request for credit. Support teams respond better to specific amounts and dates. Support teams respond better to specific amounts and dates.
How it works
What happens, step by step
Every day ClickRuntime gets your AWS spend for the last eight days.
It compares yesterday's spend with the average of the seven days before.
If yesterday was well above that average, your Slack channel gets both figures and the percentage jump. Normal days stay quiet.
Before it runs live
- Connect AWS
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other AWS steps into one automation
Under the hood
The code that runs this automation
from datetime import date, timedelta
import boto3
from clickruntime import on_trigger, credentials, notify
REGION = "us-east-1"
def aws(service):
return boto3.client(service, region_name=REGION, aws_access_key_id=credentials.secret("AWS_ACCESS_KEY_ID"),
aws_secret_access_key=credentials.secret("AWS_SECRET_ACCESS_KEY"))
@on_trigger
def run(event):
result = aws("ce").get_cost_and_usage(
TimePeriod={"Start": str(date.today() - timedelta(days=8)), "End": str(date.today())},
Granularity="DAILY", Metrics=["UnblendedCost"])["ResultsByTime"]
daily = [float(r["Total"]["UnblendedCost"]["Amount"]) for r in result]
yesterday, average = daily[-1], sum(daily[:-1]) / len(daily[:-1])
if average and yesterday > average * 1.5:
notify.slack(f"AWS spend spike: ${yesterday:,.2f} yesterday vs ${average:,.2f} 7-day average "
f"(+{(yesterday / average - 1) * 100:.0f}%)", channel="#ops")
return {"yesterday": yesterday, "average": average}FAQ
Common questions
What counts as a spike?
Which services does the alert name?
Will it alert every day during a long spike?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
See yesterday's AWS bill by service
Each morning you get yesterday's spend broken down by service, with costly ones flagged.
See how it worksTrack S3 bucket sizes daily
A daily email with each bucket's size and object count, warning you when one passes your limit.
See how it worksStore files sent to a link in S3
Files or file URLs posted to your link are saved in your bucket under the date, and you get a download link.
See how it worksKeep exploring
Set up “Catch AWS spend spikes in Slack” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.