0
0
AwsHow-ToBeginner · 4 min read

How to Use AWS Budgets: Setup and Best Practices

To use AWS Budgets, create a budget in the AWS Management Console or via AWS CLI by specifying your cost or usage limits. Set alerts to notify you when your spending approaches or exceeds these limits, helping you control your AWS costs proactively.
📐

Syntax

The main components to create an AWS Budget are:

  • BudgetName: A unique name for your budget.
  • BudgetLimit: The maximum amount you want to spend.
  • TimeUnit: The period for the budget (e.g., MONTHLY).
  • BudgetType: Type of budget, such as COST or USAGE.
  • Notifications: Alerts triggered when thresholds are met.
bash
aws budgets create-budget --account-id 123456789012 --budget '{"BudgetName":"MyMonthlyBudget","BudgetLimit":{"Amount":"100","Unit":"USD"},"TimeUnit":"MONTHLY","BudgetType":"COST"}' --notifications-with-subscribers '[{"Notification":{"NotificationType":"ACTUAL","ComparisonOperator":"GREATER_THAN","Threshold":80,"ThresholdType":"PERCENTAGE"},"Subscribers":[{"SubscriptionType":"EMAIL","Address":"user@example.com"}]}]'
Output
An AWS Budget named 'MyMonthlyBudget' is created with a $100 monthly cost limit and an alert at 80% usage sent via email.
💻

Example

This example shows how to create a monthly cost budget of $200 with an email alert at 90% usage using AWS CLI.

bash
aws budgets create-budget --account-id 123456789012 --budget '{"BudgetName":"ExampleBudget","BudgetLimit":{"Amount":"200","Unit":"USD"},"TimeUnit":"MONTHLY","BudgetType":"COST"}' --notifications-with-subscribers '[{"Notification":{"NotificationType":"ACTUAL","ComparisonOperator":"GREATER_THAN","Threshold":90,"ThresholdType":"PERCENTAGE"},"Subscribers":[{"SubscriptionType":"EMAIL","Address":"alert@example.com"}]}]'
Output
Budget 'ExampleBudget' created successfully with a $200 monthly limit and email alert at 90%.
⚠️

Common Pitfalls

Common mistakes when using AWS Budgets include:

  • Not setting the correct AccountId, which causes the budget creation to fail.
  • Forgetting to add subscribers for notifications, so alerts are never received.
  • Using incorrect threshold values or types, leading to no alerts triggering.
  • Confusing ACTUAL and FORECASTED notification types.
bash
aws budgets create-budget --account-id 123456789012 --budget '{"BudgetName":"BadBudget","BudgetLimit":{"Amount":"100","Unit":"USD"},"TimeUnit":"MONTHLY","BudgetType":"COST"}'

# Missing notifications means no alerts will be sent.

# Correct way includes notifications:
aws budgets create-budget --account-id 123456789012 --budget '{"BudgetName":"GoodBudget","BudgetLimit":{"Amount":"100","Unit":"USD"},"TimeUnit":"MONTHLY","BudgetType":"COST"}' --notifications-with-subscribers '[{"Notification":{"NotificationType":"ACTUAL","ComparisonOperator":"GREATER_THAN","Threshold":80,"ThresholdType":"PERCENTAGE"},"Subscribers":[{"SubscriptionType":"EMAIL","Address":"user@example.com"}]}]'
📊

Quick Reference

ParameterDescriptionExample
BudgetNameUnique name for the budgetMyMonthlyBudget
BudgetLimitMax spend amount and currency{"Amount":"100","Unit":"USD"}
TimeUnitBudget period (DAILY, MONTHLY, QUARTERLY, ANNUALLY)MONTHLY
BudgetTypeType of budget (COST, USAGE, RI_UTILIZATION, RI_COVERAGE)COST
NotificationTypeAlert type (ACTUAL or FORECASTED)ACTUAL
ComparisonOperatorCondition to trigger alert (GREATER_THAN, LESS_THAN)GREATER_THAN
ThresholdPercentage or absolute value to trigger alert80
SubscriptionTypeHow to receive alerts (EMAIL, SNS)EMAIL

Key Takeaways

Create AWS Budgets by defining cost or usage limits and set alerts to monitor spending.
Always add notification subscribers to receive alerts via email or SNS.
Use the correct account ID and budget parameters to avoid errors.
Choose between ACTUAL and FORECASTED notifications based on your monitoring needs.
Regularly review and adjust budgets to match your AWS usage patterns.