AWS Builder Center
My AWS Bill Is a Garden: Visualizing Cloud Costs as Plants That Grow and Wilt

My AWS Bill Is a Garden: Visualizing Cloud Costs as Plants That Grow and Wilt

A weekend build that turns AWS Cost Explorer data into a living garden: each service is a plant that grows with spend and wilts when you go over budget, built with Lambda, EventBridge, S3, and a simple SVG page.

The fear

Every student on AWS credits knows this feeling: you leave something running, forget about it, and wonder whether the bill will be a surprise. [One or two lines about your own moment, e.g. a forgotten resource or a credit scare.]
Cost dashboards are accurate but dull, and I never checked mine. So I made it something I'd actually want to look at.

The idea

My AWS bill is a garden. Each service is a plant. The more it costs, the taller it grows. When I go over budget, it wilts.

What you need

  • An AWS account with [Cost Explorer enabled]. If you've never used it, enabling it can take up to 24 hours before data shows up, so do this first.
  • Basic Python and JavaScript

Architecture

EventBridge (daily) → Lambda → Cost Explorer API → garden.json in S3 → static page draws the garden
[Diagram image]
  • EventBridge runs the Lambda once a day
  • Lambda reads yesterday's cost per service and writes one small JSON file
  • S3 stores the JSON and hosts the page
  • The page reads the JSON and draws one SVG plant per service

Step 1: The Lambda

This function asks Cost Explorer for yesterday's cost, grouped by service, keeps the top six, and groups the rest as "Other" (the wildflowers).
import boto3, json, datetime
ce = boto3.client("ce", region_name="us-east-1") s3 = boto3.client("s3") BUCKET = "YOUR-BUCKET-NAME" DAILY_BUDGET = 1.00 # dollars per day, change this
def handler(event, context): end = datetime.date.today() start = end - datetime.timedelta(days=1)
resp = ce.get_cost_and_usage(
TimePeriod={"Start": start.isoformat(), "End": end.isoformat()},
Granularity="DAILY",
Metrics=["UnblendedCost"],
GroupBy=[{"Type": "DIMENSION", "Key": "SERVICE"}],
)
groups = resp["ResultsByTime"][0]["Groups"]
services = sorted(
[{"name": g["Keys"][0],
"cost": float(g["Metrics"]["UnblendedCost"]["Amount"])} for g in groups],
key=lambda s: s["cost"], reverse=True,
)
top, rest = services[:6], services[6:]
if rest:
top.append({"name": "Other", "cost": sum(s["cost"] for s in rest)})
data = {"date": start.isoformat(), "daily_budget": DAILY_BUDGET, "services": top}
s3.put_object(
Bucket=BUCKET, Key="garden.json",
Body=json.dumps(data), ContentType="application/json",
CacheControl="no-cache",
)
return {"ok": True}

Step 2: Permissions

The Lambda's role needs only two things: permission to read cost data and permission to write one file.
{ "Version": "2012-10-17", "Statement": [ {"Effect": "Allow", "Action": "ce:GetCostAndUsage", "Resource": "*"}, {"Effect": "Allow", "Action": "s3:PutObject", "Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/garden.json"} ] }
Keeping it that narrow means a bug or a leaked function can't touch anything else.

Step 3: The daily schedule

In EventBridge Scheduler, I created a rule that runs the Lambda once a day with a cron expression: cron(0 6 * * ? *). Cost data lags, so I run it in the morning.

Step 4: Drawing the garden

The page loads garden.json and draws one plant per service. Height comes from cost, colour comes from how much of the daily budget
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article