AWS::Budgets::Budget
AWS::Budgets::Budget
资源为账单和成本管理创建、替换或删除预算。有关更多信息,请参阅 AWS 账单和成本管理用户指南 中的使用预算管理成本。
语法
要在 AWS CloudFormation 模板中声明此实体,请使用以下语法:
JSON
{ "Type" : "AWS::Budgets::Budget", "Properties" : { "Budget" :
BudgetData
, "NotificationsWithSubscribers" :[ NotificationWithSubscribers, ... ]
} }
YAML
Type: AWS::Budgets::Budget Properties: Budget:
BudgetData
NotificationsWithSubscribers:- NotificationWithSubscribers
属性
Budget
-
要创建的预算对象。
必需:是
类型:BudgetData
Update requires: No interruption
NotificationsWithSubscribers
-
要与预算关联的通知。一个预算可以有最多 5 条通知,每条通知可以有 1 位 SNS 订阅者和最多 10 位电子邮件订阅者。如果您在
CreateBudget
调用中包含了通知和订阅者,AWS 会为您创建通知和订阅者。必需:否
类型:NotificationWithSubscribers 的列表
最高:
10
Update requires: Replacement
返回值
Ref
在将此资源的逻辑 ID 传递给内部 Ref
函数时,Ref
返回由模板创建的预算的名称。
For more information about using the Ref
function, see Ref.
示例
100 美元的预算(带 2 个通知)
以下示例为 100 美元成本创建一个预算,该预算具有在支出超过 80 美元或 99 美元时发送的通知。这些通知将被发送到订阅者 email@example.com
和 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
另请参阅
-
AWS Cost Explorer Service Cost Management API 中的 CreateBudget