Table of contents
Creating budgets in an AWS account is crucial for cost management and control. Budgets help learners and professionals monitor their spending and avoid unexpected charges. By setting up cost and usage budgets, users receive alerts when they approach or exceed their specified thresholds. This proactive approach enables better financial planning, ensures adherence to budget constraints, and promotes a deeper understanding of cloud cost structures. Additionally, AWS Budgets can track specific services, helping users identify cost-saving opportunities and optimize resource usage, making it an essential practice for efficient cloud management.
For this demo I will be creating AWS Budgets in Free tier account under root user. Here’s a concise list of prerequisites:
AWS Account: Ensure you have an AWS account with Free Tier access.
Active Email account which you can use for alert monitoring.
I will be creating monthly budget in Root account using CloudFormation Template. Let’s assume we are creating 5 USD amount budget, when you have spent equals to threshold of 70 percentage you will get email notification or if you cross over 80 threshold value for desired budget amount you will get email notification. We will be creating CloudFormation stack in ap-south-1 region i.e. Mumbai.
Note: You can customize default value as needed.
Step 1: Please find below attached code for creating CloudFormation template and save this code in system with name as budget_template.yaml
Description: "Creating AWS Monthly Budget for Learning Purpose"
Parameters:
Amount:
Type: Number
Description: The cost or usage amount that's associated with a budget forecast, actual spend, or budget threshold.
Default: 5
Unit:
Type: String
Description: The unit of measurement that's used for the budget forecast, actual spend, or budget threshold.
Default: USD
TimeUnit:
Type: String
Description: The length of time until a budget resets the actual and forecasted spend.
Default: MONTHLY
BudgetType:
Type: String
Description: Specifies whether this budget tracks costs, usage, RI utilization, RI coverage, Savings Plans utilization, or Savings Plans coverage.
Default: COST
NotificationType:
Type: String
Description: Specifies whether the notification is for how much you have spent (ACTUAL) or for how much that you're forecasted to spend (FORECASTED).
Default: ACTUAL
ComparisonOperatorEqual:
Type: String
Description: The comparison that's used for this notification.
Default: EQUAL_TO
Threshold1:
Type: Number
Description: The threshold that's associated with a notification.
Default: 70
ComparisonOperatorGreater:
Type: String
Description: The comparison that's used for this notification.
Default: GREATER_THAN
Threshold2:
Type: Number
Description: The threshold that's associated with a notification.
Default: 80
SubscriptionType:
Type: String
Description: The type of notification that AWS sends to a subscriber.
Default: EMAIL
Address:
Type: String
Description: The address that AWS sends budget notifications to, either an SNS topic or an email.
Default: example@gmail.com
Resources:
LearningBudget:
Type: "AWS::Budgets::Budget"
Properties:
Budget:
BudgetLimit:
Amount: !Ref Amount
Unit: !Ref Unit
TimeUnit: !Ref TimeUnit
BudgetType: !Ref BudgetType
NotificationsWithSubscribers:
- Notification:
NotificationType: !Ref NotificationType
ComparisonOperator: !Ref ComparisonOperatorEqual
Threshold: !Ref Threshold1
Subscribers:
- SubscriptionType: !Ref SubscriptionType
Address: !Ref Address
- Notification:
NotificationType: !Ref NotificationType
ComparisonOperator: !Ref ComparisonOperatorGreater
Threshold: !Ref Threshold2
Subscribers:
- SubscriptionType: !Ref SubscriptionType
Address: !Ref Address
Outputs:
BudgetId:
Value: !Ref LearningBudget
Step 2: From AWS Console Home search CloudFormation and open CloudFormation service
Step 3: You will able to see below mentioned screen and click on yellow highlighted part i.e. create stack
Step 4: When you click on create stack as dropdown window will appear and select With new resources(standard) and it will redirect to below mentioned screen
Step 5: Select Choose an existing template under Prerequisite section and under Specify template select Upload a template file.
Step 6: Select Choose file from selecting location where you have saved template code. If no errors in file then it allow you to click on Next button.
Step 7: Under Stack Name Provide desired stack name as per limit ie. Monthly-learning-Budget-Stack and under parameters tab you can see what have you have specified in yaml file. Then click on next button.
Step 8: Under Configure Stack option we are not changing any values so click on next button.
Step 9: Under Review and Create just click on submit button. After that you will able to see Stack details as per name which you have specified and once stack is in Create Complete you are good.
Step 10: Under Resources Section of Stack you can see Budget Link and through that you can review Learning Budget which you have created.
Real-Life Example: Why This Budget Matters
Let’s assume you're a student learning AWS or a developer running test environments. You may only want to spend $5 per month on services like EC2, Lambda, or S3. By setting up this budget, you’ll get notified when your expenses approach the set limit, allowing you to stop or optimize resources before overspending.
For instance, if you're using EC2 instances for practice, AWS Budgets can notify you when your usage approaches your set threshold. This can help you identify areas where you're consuming unnecessary resources (like leaving instances running) and make adjustments to reduce costs.
Conclusion
AWS Budgets is a powerful tool for managing cloud costs. By setting proactive budgets with notifications, you can stay within your desired spending limit, avoid surprises, and optimize your resources efficiently. Whether you're a beginner using the Free Tier or managing a large-scale cloud environment, AWS Budgets provides an essential layer of control over your expenses.
Remember: Budgeting isn't just for saving money—it's about understanding where your resources are going and making smarter decisions.
Thank you for reading! If this blog helped you, don't forget to subscribe and follow for more insightful content. Feel free to leave your thoughts or suggestions in the comments below. Happy learning!
Connect and Follow Me on Socials Network