如何从 AWS Athena 访问成本分配标签数据

How do I access Cost Allocation Tag data from AWS Athena

我有一个 Cost and Usage report 配置为将每小时数据传送到 S3 存储桶。我使用 AWS Athena.

查询

配置附在下面。它明确指出 Cost Allocation Tags 包含在报告中。但是,此数据未显示在我的 Athena 查询中。我也没有在 table 中看到任何与 Cost Allocation Tags.

相关的列

我已激活 Cost Allocation Tags,它们正确显示在 Cost Explorer 中。

我浏览了 AWS 文档,但没有找到任何相关内容。

那么,如何从 AWS Athena 访问成本分配标签数据?

发布问题后我找到了解决方案。

我后来创建了 Cost Allocation Tags,所以它们没有包含在 Athena table 中。我不得不手动添加这些列,然后它就起作用了。

这是修复它的代码片段:

ALTER TABLE <reducted>.<reducted> ADD COLUMNS (resource_tags_aws_cloudformation_stack_id string, resource_tags_aws_cloudformation_stack_name string)

我设法从报告所在的 S3 存储桶中的 billing-create-table.sql 中找到了列名。