Bootstrap FreeKB - Amazon Web Services (AWS) - Create a Budget using the AWS CLI
Amazon Web Services (AWS) - Create a Budget using the AWS CLI

Updated:   |  Amazon Web Services (AWS) articles

This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.

Budgets can be used to do something, such as:

  • Send an email alert

When some conditiion is met, such as:

  • Spend is forcasted to exceed x
  • Spend has exceeded x

This is similar to setting up a Cloudwatch billing alert. Check out my article Create Billing Cloudwatch Alarm using the AWS CLI.

For example, you would receive an email like this.

 

Let's say you have a JSON file named budget.json that contains the following.

{
    "Budget": {
        "BudgetName": "My Monthly Cost Budget",
        "BudgetLimit": {
            "Amount": "1000.0",
            "Unit": "USD"
        },
        "CostFilters": {},
        "CostTypes": {
            "IncludeTax": true,
            "IncludeSubscription": true,
            "UseBlended": false,
            "IncludeRefund": false,
            "IncludeCredit": false,
            "IncludeUpfront": true,
            "IncludeRecurring": true,
            "IncludeOtherSubscription": true,
            "IncludeSupport": true,
            "IncludeDiscount": true,
            "UseAmortized": false
        },
        "TimeUnit": "MONTHLY",
        "BudgetType": "COST"
    }
}

 

And a JSON file named subscribers.json that contains the following.

[
    {
        "Notification": {
            "ComparisonOperator": "GREATER_THAN",
            "NotificationType": "ACTUAL",
            "Threshold": 80,
            "ThresholdType": "PERCENTAGE"
        },
        "Subscribers": [
            {
                "Address": "john.doe@example.com",
                "SubscriptionType": "EMAIL"
            }
        ]
    }
]

 

The aws budgets create-budget command can be used to create the budget.

aws budgets create-budget \
    --account-id 111122223333 \
    --budget file://budget.json \
    --notifications-with-subscribers file://subscribers.json

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 29c3ec in the box below so that we can be sure you are a human.