AWS::Budgets::Budget
The AWS::Budgets::Budget
resource allows customers to take pre-defined actions that will trigger once a budget threshold has been exceeded. creates, replaces, or deletes budgets for Billing and Cost Management.
For more information, see
Managing Your Costs with Budgets
in the
AWS Billing and Cost Management User Guide.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::Budgets::Budget", "Properties" : { "Budget" :
BudgetData
, "NotificationsWithSubscribers" :[ NotificationWithSubscribers, ... ]
, "ResourceTags" :[ ResourceTag, ... ]
} }
YAML
Type: AWS::Budgets::Budget Properties: Budget:
BudgetData
NotificationsWithSubscribers:- NotificationWithSubscribers
ResourceTags:- ResourceTag
Properties
Budget
-
The budget object that you want to create.
Required: Yes
Type: BudgetData
Update requires: No interruption
NotificationsWithSubscribers
-
A notification that you want to associate with a budget. A budget can have up to five notifications, and each notification can have one SNS subscriber and up to 10 email subscribers. If you include notifications and subscribers in your
CreateBudget
call, AWS creates the notifications and subscribers for you.Required: No
Type: Array of NotificationWithSubscribers
Maximum:
10
Update requires: Replacement
-
An optional list of tags to associate with the specified budget. Each tag consists of a key and a value, and each key must be unique for the resource.
Required: No
Type: Array of ResourceTag
Minimum:
0
Maximum:
200
Update requires: No interruption
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the name of the budget that is created by the template.
For more information about using the Ref
function, see Ref
.
Fn::GetAtt
The Fn::GetAtt
intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAtt
intrinsic function, see Fn::GetAtt
.
Examples
Budget for 100 USD with two notifications
The following example creates a budget for 100 USD amount of costs, with notifications for when you have spent over
80 USD or over 99 USD. The notifications are sent to the subscribers email@example.com
and email2@example.com
.
JSON
{ "Description": "Basic Budget test", "Resources": { "Budget": { "Type": "AWS::Budgets::Budget", "Properties": { "Budget": { "BudgetLimit": { "Amount": "100", "Unit": "USD" }, "TimeUnit": "MONTHLY", "TimePeriod": { "Start": "1225864800", "End": "1926864800" }, "BudgetType": "COST", "CostFilters": { "AZ": [ "us-east-1", "us-west-1", "us-east-2" ] } }, "NotificationsWithSubscribers": [ { "Notification": { "NotificationType": "ACTUAL", "ComparisonOperator": "GREATER_THAN", "Threshold": 99 }, "Subscribers": [ { "SubscriptionType": "EMAIL", "Address": "email@example.com" }, { "SubscriptionType": "EMAIL", "Address": "email2@example.com" } ] }, { "Notification": { "NotificationType": "ACTUAL", "ComparisonOperator": "GREATER_THAN", "Threshold": 80 }, "Subscribers": [ { "SubscriptionType": "EMAIL", "Address": "email@example.com" } ] } ] } } }, "Outputs": { "BudgetId": { "Value": "BudgetExample" } } }
YAML
--- Description: "Basic Budget test" Resources: BudgetExample: Type: "AWS::Budgets::Budget" Properties: Budget: BudgetLimit: Amount: 100 Unit: USD TimeUnit: MONTHLY TimePeriod: Start: 1225864800 End: 1926864800 BudgetType: COST CostFilters: AZ: - us-east-1 - us-west-1 - us-east-2 NotificationsWithSubscribers: - Notification: NotificationType: ACTUAL ComparisonOperator: GREATER_THAN Threshold: 99 Subscribers: - SubscriptionType: EMAIL Address: email@example.com - SubscriptionType: EMAIL Address: email2@example.com - Notification: NotificationType: ACTUAL ComparisonOperator: GREATER_THAN Threshold: 80 Subscribers: - SubscriptionType: EMAIL Address: email@example.com Outputs: BudgetId: Value: !Ref BudgetExample
See also
-
CreateBudget in the AWS Cost Explorer Service Cost Management APIs