DEV Community

Michael Wahl for AWS Community Builders

Posted on

Amazon Web Services — Budgets

If you aren’t familiar, head on over and visit the AWS Billing & Cost Management Dashboard — https://console.aws.amazon.com/billing/home. Under Cost management, select Budgets, this is where you will build your very own AWS budget.
The first step in creating an AWS budget is to decide what type of budget you are looking for. For this example, I will be using a Cost budget.

Next you will need to fill in a few details for your budget. I have decided to show you both the fixed monthly amount and the monthly budget planning. The monthly budget planning allows you to set a starting amount and then budget for a % of growth per month!

You may also decide to include some additional and optional budget parameters. If you have already established a solid key/value tagging scheme, this can be really helpful to scope per workload, product or service.

Next, you will configure thresholds such as your budget threshold, set up notifications, and any budget actions which is truly magic!
Remember, if you do decide to use Budget actions, there are some specific IAM permissions that are required to execute an action on your behalf. More info on the IAM permissions is available below.

Budget Action
For this example, I have configured a budget action, where once the budget threshold I set is reached, the specific EC2 instance will be stopped and I will be notified via email, Amazon SNS or even using AWS Chatbot Alerts!

IAM Role Permissions
Trust Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "budgets.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Permissions policies
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeInstanceStatus",
"ec2:StartInstances",
"ec2:StopInstances",
"iam:AttachGroupPolicy",
"iam:AttachRolePolicy",
"iam:AttachUserPolicy",
"iam:DetachGroupPolicy",
"iam:DetachRolePolicy",
"iam:DetachUserPolicy",
"organizations:AttachPolicy",
"organizations:DetachPolicy",
"rds:DescribeDBInstances",
"rds:StartDBInstance",
"rds:StopDBInstance",
"ssm:StartAutomationExecution"
],
"Resource": "*"
}
]
}

Complete article and others here https://voice.michaelwahl.org/amazon-web-services-budgets-4f99ce3d17b1

Top comments (0)