DEV Community

Cover image for Day 2 — Cost Controls
Ismail G.
Ismail G.

Posted on

Day 2 — Cost Controls

When setting up infrastructure for a startup, cost control is not something to “add later.” It has to be built into the foundation from the very beginning.

AWS operates on a pay-as-you-go model. That flexibility is powerful, but it also means that a small misconfiguration, an unused resource, or an unexpected traffic spike can quickly turn into a serious bill.

On Day 1, we focused on security (root user, IAM, MFA).
On Day 2, we make sure we never get surprised by costs.

Avoid unexpected AWS bills by setting up:

Budget alerts
Cost anomaly detection
Billing alarms

Step 1 — Create a Budget

The first and most important control is a simple monthly budget.

Navigate in AWS Console

Go to:

Billing → Budgets → Create budget

Budget Setup

Choose:

Budget type: Cost budget
Period: Monthly

Configure Alerts

Creating a budget alone is not enough.
Alerts are what make cost control actually useful.

Recommended setup:

60% of budget → Email notification
80% of budget → Email + SNS notification
100% of budget → Critical alert

To configure alerts properly, switch from the simplified template to:

Customize (advanced)

This allows you to define precise thresholds and notification behavior.

After selecting Customize (advanced) and setting your budget amount:

Scroll down to the Alerts section
Click Add an alert threshold

Recommended Alert Setup (Best Practice)

To get full visibility, configure three alert levels:

  1. 50% — Early Warning Threshold: 50% Type: Actual cost Notification: Email

This is your first checkpoint.

It helps you detect:

Unused resources
Misconfigurations
Unexpected usage

  1. 80% — Risk Level

Threshold: 80%
Type: Actual cost
Notification: Email + SNS (optional)

At this stage, you should actively investigate your spending.

  1. 100% — Critical

Threshold: 100%
Type:
Forecasted cost

This is the most important alert. The forecasted cost option allows AWS to warn you before you actually exceed your budget.

If you see your budget and alert thresholds, this step is complete.

Step 2 — Cost Anomaly Detection

Budgets are static. They only track thresholds.

But what if something unusual happens before reaching your budget?

That’s where anomaly detection comes in.

Navigate in AWS Console

Go to:

Billing → Cost Anomaly Detection

Create a cost monitor:

Choose Monitor Type:

Choose Managed by AWS:

AWS automatically analyzes your historical usage
It learns your normal spending patterns
It detects anomalies without manual configuration

This is the best choice for startups and early-stage setups.

Select AWS Services for Monitor Dimension. This will:

Track spending per service (EC2, S3, RDS, etc.)
Detect anomalies within each service

Configure alert subscriptions

An alert subscription notifies you when a cost monitor detects an anomaly. Depending on the alert frequency, you can notify designated individuals by email or Amazon SNS.

  1. Create a New Subscription

  2. Subscription Name

Use something descriptive:

Cost-Anomaly-Alerts
Startup-Billing-Alerts
DevOps-Cost-Monitor

This becomes important when you have multiple teams or monitors.

  1. Alerting Frequency

AWS gives you 3 options:

Individual Alerts
You get notified immediately when an anomaly is detected

Best for production environments and critical cost control.

Daily Summaries:
AWS groups anomalies and sends once per day

Best for low-noise monitoring and early-stage setups.

Weekly Summaries:
Lowest noise, but slow response

Blog recommendation

Use Individual alerts if you want real-time control.
Use Daily summaries if you want less noise.

  1. Alert Recipients, write here the email address.

  2. Threshold

When configuring the threshold, you can choose between an absolute amount or a percentage above expected spend. Amount-based thresholds are better for controlling real financial impact, while percentage-based thresholds are more effective at detecting unusual behavior relative to your normal usage.

Choose: When the anomaly impact is 25.00% above the expected spend, you receive anomaly alerts.

CloudWatch Billing Alarm

If your goal is simply to track spending and receive alerts, AWS Budgets is enough and you do not need CloudWatch alarms. CloudWatch billing alarms become useful when you need automation, integrations, or real-time operational responses.

In most startup setups, Budgets handle visibility, while CloudWatch is added later for advanced control.

Top comments (0)