AWS - 用 Cost Allocation Tags 追蹤成本


AWS Cost Allocation Tags

Cost Allocation Tags 是 AWS 用來標記 AWS 資源,讓你能依照 Tag 在 Cost Explorer、CUR、Billing Report 中追蹤成本。


為什麼需要 Cost Allocation Tags

沒有 Tags 你看不到

  • 哪個專案花多少錢
  • 哪個部門花多少錢
  • 哪個環境(dev/staging/prod) 最貴
  • 哪位使用者花最多 EC2

有 Tag 後可以變成

1
2
3
4
Project = mobile-app -> 每月多少?
Owner = team-a -> 多少?
Environments = production -> 多少?
CostCenter = Finance -> 多少?

全部都可以在 Cost Explorer/CUR 自動分攤成本


Cost Tags 分兩種

類型說明
AWS-generated tags例如: aws:createdBy, aws:cloudformation:stack-name
User-defined tags你自己建立 (Project=XYZ)

不會自動算成本,必須先去 Billing 啟用!


如何讓 Tag 開始用於成本結算

步驟:一定要啟用

1
2
3
AWS Billing Console
-> Cost Allocation Tags
-> Activate

啟用後:

  • Tag 才會出現在 Cost Explorer
  • 才會出現在 Cost & Usage Report(CUR)
  • 才能依照 Tag 分攤成本

從 Tag 追蹤成本的三種方法

工具功能
Cost Explorer看 Tag -> 每月成本趨勢
Cost & Usage Report(CUR)最細緻,資料可丟到 Athena 或 S3 分析
Budgets為 Tag 建立預算告警(例如 Project A 月預算)

Reference

  • AWS - Organizing and tracking costs using AWS cost allocation tags