Daily
Track S3 bucket sizes daily
A daily email with each bucket's size and object count, warning you when one passes your limit.
- Runs
- Daily
- Apps
- AWS
- AI
- Not needed
- Access
- s3:ListAllMyBuckets, cloudwatch:GetMetricStatistics
Send this to your assistant
Create a ClickRuntime automation: every day at 9am, email me the size and object count of each of my S3 buckets and warn me if any is over 100 GB.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
S3 feels cheap until it is not. A team stores user uploads, nightly database backups, application logs and old build artifacts in a dozen buckets. Nobody deletes anything, lifecycle rules were never configured, and the logs bucket grows by hundreds of gigabytes a month. The first time anyone looks at bucket size is when the storage line on the bill has tripled, and cleaning up then means a tense afternoon of deciding what is safe to remove.
Each day, ClickRuntime lists your buckets and reads the BucketSizeBytes and NumberOfObjects metrics that AWS publishes to CloudWatch. It emails a table with each bucket's size and object count, and adds a warning next to any bucket that has passed the size limit you chose.
Engineering managers and platform teams use it to keep storage growth under watch without building a dashboard.
What you get out of it
Runaway growth is visible early
A log bucket gaining fifty gigabytes a day is easy to see in a daily table and invisible in a monthly bill. You can add a lifecycle rule while the cleanup is still small.
Limits turn into warnings you can act on
Setting a ceiling for each bucket means the email tells you when something crosses it. You decide whether to archive, expire or raise the limit with the facts in front of you.
Unused buckets get noticed
A staging bucket from a finished project still costs money every day. A list of all buckets with sizes reminds you which ones nobody has touched and which can safely be removed.
Object counts reveal hidden problems
A sudden jump in the number of objects can mean a bug is writing millions of tiny files. Object count catches that even when total size looks fine. Catching that early prevents a large and confusing bill later.
Storage budgets can be defended
When finance asks why storage costs rose, you have a record of growth by bucket from the daily emails. The explanation is a fact, not a guess. The explanation comes from a record, not a guess.
How it works
What happens, step by step
Every day ClickRuntime lists your S3 buckets.
It reads each bucket's size and number of files from AWS's storage figures.
Buckets over the size limit you set are marked with a warning.
The list arrives in your inbox, largest concerns first.
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 datetime, timedelta, timezone
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"))
WARN_GB = 100
def metric(cw, bucket, name, storage):
points = cw.get_metric_statistics(Namespace="AWS/S3", MetricName=name, Period=86400, Statistics=["Average"],
StartTime=datetime.now(timezone.utc) - timedelta(days=2), EndTime=datetime.now(timezone.utc),
Dimensions=[{"Name": "BucketName", "Value": bucket}, {"Name": "StorageType", "Value": storage}])["Datapoints"]
return max(points, key=lambda p: p["Timestamp"])["Average"] if points else 0
@on_trigger
def run(event):
cw, lines = aws("cloudwatch"), []
for b in aws("s3").list_buckets()["Buckets"]:
gb = metric(cw, b["Name"], "BucketSizeBytes", "StandardStorage") / 1e9
objects = metric(cw, b["Name"], "NumberOfObjects", "AllStorageTypes")
lines.append(f"{'WARNING ' if gb > WARN_GB else ''}{b['Name']}: {gb:,.1f} GB, {objects:,.0f} objects")
notify.email_me("S3 bucket sizes", "\n".join(lines))
return {"buckets": len(lines)}FAQ
Common questions
Why do the metrics sometimes look a day old?
Does it need access to the files in the buckets?
Can different buckets have different limits?
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 worksCatch AWS spend spikes in Slack
Slack warns you when a day's spend jumps well above the recent average.
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 “Track S3 bucket sizes daily” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.