The Secret Life of AWS: The Sticker Shock (Cost Explorer & Budgets)

 

The Secret Life of AWS: The Sticker Shock (Cost Explorer & Budgets)

Who left the lights on? How to track your spending with AWS Cost Explorer.





Part 31 of The Secret Life of AWS

Timothy was in a great mood. His application was running smoothly. The "Assembly Line" (Episode 29) was deploying updates automatically. The "Occupancy Limit" (Episode 30) had been raised.

He opened his email and saw a notification from AWS.

Subject: Your AWS Bill for January.

He clicked it, expecting a small number. He froze.

Total: $4,520.00

"Four thousand..." Timothy whispered, the color draining from his face. "Four thousand dollars?"

He ran to Margaret’s desk. "Margaret! We've been hacked! Someone is running Bitcoin miners in my account! Look at this bill!"

Margaret looked at the screen. She didn't gasp. She didn't scold him. She just adjusted her glasses.

"We haven't been hacked, Timothy," she said calmly. "We have just been... enthusiastic."

"We need to play detective," she said. "We need Cost Explorer."

The Investigation

Margaret navigated to the AWS Cost Management console and clicked Cost Explorer.

A colorful bar chart appeared on the screen. It showed a massive spike starting two weeks ago.

"The bill isn't coming from the production traffic," Margaret observed, pointing to the small blue bar labeled Lambda. "That is only $50. You are efficient."

She pointed to the huge orange bar labeled RDS and a gray bar labeled EC2-Other.

"The cost is coming from here," she said. "Development."

"But Dev is just for testing!" Timothy protested. "And what is EC2-Other? I don't even use EC2!"

"EC2-Other is usually where the Zombies hide," Margaret explained. "It’s the unattached hard drives (EBS volumes), the static IP addresses, and the snapshots you forgot about."

"Do you remember when you learned to use SAM to create environments?" she asked gently. "And you ran sam deploy to create a Feature-A stack? And then a Feature-B stack? And a Load-Test stack?"

Timothy nodded slowly. "Yes... I wanted to test each feature in isolation."

"And did you delete them when you were finished?"

Timothy went silent.

Margaret filtered the view by Tag: Environment.

  • Production: $120
  • Dev-Feature-A: $800
  • Dev-Feature-B: $800
  • Dev-Load-Test: $1,200

"Oh no," Timothy whispered. "I left the lights on."

"You built a hotel," Margaret said softly, "and you left the air conditioning running in every single room, even though no one was staying there."

"Those test databases have been running 24/7 for two weeks. AWS charges for them whether you use them or not."

The Cleanup

"I can fix this," Timothy said, pulling up his terminal.

He ran sam delete for every old stack.

  • Deleting Dev-Feature-A...
  • Deleting Dev-Feature-B...
  • Deleting Dev-Load-Test...

Within minutes, the Zombie Resources were gone.

"Pro Tip," Margaret added. "If you ever lose track of your resources, use AWS Resource Groups. It lets you search for everything with the tag Environment: Dev so you can find them and delete them in one click."

The Alarm

She navigated to AWS Budgets.

"We are going to set a guardrail," she said.

She clicked Create Budget.

  1. Budget Type: Cost
  2. Amount: $500.00
  3. Alert: Notify timothy@example.com when actual spend reaches 80% ($400).

"Now," she explained, "if you leave the lights on again, AWS will email you the moment the bill hits $400. You won't have to wait until the end of the month to be surprised."

"And for the development environments," she added, "we can add a rule to your template.yaml. We can configure the databases to AutoPause after 1 hour of inactivity."

Timothy looked at the Cost Explorer graph. The projected cost for next month had already dropped back down to $200.

"I thought I was being productive by spinning up all those environments," Timothy admitted.

"You were," Margaret assured him. "Speed is good. But in the cloud, speed costs money. A good architect knows how to build fast and clean up after themselves."

Timothy paid the bill. It was a painful lesson, but he knew he would never leave the lights on again.


Key Concepts

  • AWS Cost Explorer: A tool to visualize and analyze your AWS spending. You can filter by Service (e.g., Lambda, RDS), Tag (e.g., Project, Environment), or Time.
  • Zombie Resources: Resources (like RDS databases or unattached EBS volumes in EC2-Other) that are running and costing money but are no longer being used.
  • AWS Budgets: A service that allows you to set custom cost and usage budgets and alerts you when you exceed (or are forecasted to exceed) your threshold.
  • Tagging: Assigning metadata (like Environment: Dev) to resources so you can track exactly which project is spending the money.

Aaron Rose is a software engineer and technology writer at tech-reader.blog and the author of Think Like a Genius.

Comments

Popular posts from this blog

The New ChatGPT Reason Feature: What It Is and Why You Should Use It

Insight: The Great Minimal OS Showdown—DietPi vs Raspberry Pi OS Lite

Raspberry Pi Connect vs. RealVNC: A Comprehensive Comparison