【问题标题】:Create AWS budget alert创建 AWS 预算提醒
【发布时间】:2021-08-14 09:03:54
【问题描述】:

我正在尝试通过 Terraform 在门户中复制创建 AWS 预算警报的过程。

在门户中,我导航到账单,然后创建预算,我可以创建一个警报,其中包含我的整个订阅条件,预算不超过一定金额,否则向特定组发送电子邮件或人。

如何通过 Terraform 创建相同的内容?我没有看到任何有效的文档。

【问题讨论】:

标签: amazon-web-services terraform devops monitoring


【解决方案1】:

预算使用 Cost Explorer 提供的成本可视化来向您显示预算状态,提供估计成本的预测,并跟踪您的 AWS 使用情况,包括您的免费套餐使用情况。

示例用法

resource "aws_budgets_budget" "ec2" {
  name              = "budget-ec2-monthly"
  budget_type       = "COST"
  limit_amount      = "1200"
  limit_unit        = "USD"
  time_period_end   = "2087-06-15_00:00"
  time_period_start = "2017-07-01_00:00"
  time_unit         = "MONTHLY"

  cost_filter {
    name = "Service"
    values = [
      "Amazon Elastic Compute Cloud - Compute",
    ]
  }

  notification {
    comparison_operator        = "GREATER_THAN"
    threshold                  = 100
    threshold_type             = "PERCENTAGE"
    notification_type          = "FORECASTED"
    subscriber_email_addresses = ["test@example.com"]
  }
}

在下面的链接中进行了解释。 https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/budgets_budget

https://rafaelribeiro.io/blog/billings-alarms-aws-using-terraform

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-10-14
    • 1970-01-01
    • 2011-02-05
    • 2011-07-03
    • 2017-12-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多