🐰
TerraformでAWS budgetsを設定する
概要
- TerraformをつかってAWS budgetsを設定した時のメモ
コード
- main.tf
provider "aws" {
region = "ap-northeast-1"
}
resource "aws_budgets_budget" "total" {
name = "sample_budgets"
budget_type = "COST"
limit_amount = "1000"
limit_unit = "USD"
time_unit = "MONTHLY"
notification {
comparison_operator = "GREATER_THAN"
threshold = 85
threshold_type = "PERCENTAGE"
notification_type = "FORECASTED"
subscriber_email_addresses = ["sre@e-mail.com"]
}
notification {
comparison_operator = "GREATER_THAN"
threshold = 100
threshold_type = "PERCENTAGE"
notification_type = "FORECASTED"
subscriber_email_addresses = ["sre@e-mail.com","cto@e-mail.com"]
}
notification {
comparison_operator = "GREATER_THAN"
threshold = 100
threshold_type = "PERCENTAGE"
notification_type = "ACTUAL"
subscriber_email_addresses = ["sre@e-mail.com","cto@e-mail.com","invoice@e-mail.com"]
}
}
解説
limit_amount
: 予算額
limit_unit
: 通貨
notification
: 複数記載することで段階的な通知ができる
threshold
: 閾値
threshold_type
: PERCENTAGE
パーセンテージ OR ABSOLUTE_VALUE
絶対値
notification_type
: FORECASTED
予想 OR ACTUAL
実数
subscriber_email_addresses
: 通知先、Listなので複数記載可能
- その他
-
cost_filter
を設定すると特定のサービスだけに絞ることも可能
-
参考
Discussion