AWS Cost Explorer 完全指南

数据延迟
24h
最近24小时数据
保留期限
14个月
成本历史记录
可视化维度
10+
服务/标签/账户
RI覆盖率
自动
建议生成

$ aws cost-explorer --start

想象一下,你每个月的云账单像一团乱麻——EC2、S3、RDS、Data Transfer 各种费用混在一起,根本看不清钱到底花在哪里。AWS Cost Explorer 就是你的"财务透视镜",让你对云支出一目了然。

什么是 AWS Cost Explorer?

AWS Cost Explorer 是 AWS 提供的原生成本可视化工具,免费内置于 AWS Billing Console 中。它能够:

小提示:Cost Explorer 数据每天更新一次(UTC 午夜),所以你看到的是"昨天之前"的费用数据,而不是实时数据。

Cost Explorer 核心功能详解

1. 成本趋势可视化(Cost and Usage)

这是最常用的功能。你可以看到:

2. 过滤器和分组(Filter & Group By)

这是 Cost Explorer 最强大的地方。你可以通过多个维度组合过滤:

$ aws ce get-cost-and-usage \
  --time-period Start=2025-01-01,End=2025-05-01 \
  --granularity MONTHLY \
  --metrics "BlendedCost" "UnblendedCost" "UsageQuantity" \
  --group-by Type=TAG,Key=Environment

3. 预留实例建议(RI Recommendations)

Cost Explorer 会分析你的 EC2 和 RDS 使用历史,生成三种购买建议:

建议阅读: RI 不是银弹。如果你的实例使用率低于 40%,或者业务有明显季节性,可能 Spot Instances 更适合你。

4. 成本异常检测(Anomaly Detection)

2022 年 AWS 推出的功能,机器学习驱动的异常识别:

实战:如何使用 Cost Explorer 找到浪费

第一步:识别"沉默成本"

打开 Cost Explorer,按 UsageType 分组,查看是否有:

第二步:标签化成本分析

如果你的团队已经开始使用标签策略(Tagging),可以将 Cost Explorer 与 Cost Allocation Tags 结合:

注意:Cost Allocation Tags 需要开启后等待 24 小时才会出现在报告中。

第三步:设置预算和告警

$ aws budgets create-budget \
  --account-id 123456789012 \
  --budget file://budget.json

Cost Explorer API 高级用法

如果你需要自动化报告,可以用 AWS CLI 或 SDK 调用 Cost Explorer API:

最佳实践总结

常见问题 FAQ

Q: Cost Explorer 数据多久更新?
A: 每天 UTC 00:00 更新一次,有 24 小时延迟。

Q: Cost Explorer 免费吗?
A: 基本使用免费,但 Cost Anomaly Detection 有一定免费额度。

Q: 可以导出数据吗?
A: 可以,通过 API 或 CSV 导出功能。

善用 AWS Cost Explorer,让每一分钱都花在刀刃上!

$ share --net https://981263.xyz/S-003-AWS-Cost-Explorer.html

Practical review before using this page

The S 003 AWS Cost Explorer resource should be read together with the rest of Cloud Cost Optimization Dashboard, not as an isolated shortcut. Before acting on the page, write down the current baseline, the assumption you are making, and the result you expect to see. This makes the page more useful for comparison and reduces the chance of changing several variables at once.

For FinOps planning, cloud cost allocation, rightsizing, tagging governance, and monthly cost review, a good review habit is to separate stable facts from estimates. Stable facts might include dates, page URLs, account names, measured values, or the exact checklist items you completed. Estimates should be labeled as estimates and revisited later. If the result affects money, health, safety, compliance, or operational risk, use the page as preparation for a more careful review rather than as the final authority.

Common mistakes to avoid

Use this page as a planning reference before changing cloud accounts. Confirm pricing, contracts, and technical limits in the relevant provider console because cloud terms can change.