首页 > 解决方案 > 使用 python 和 boto3 在 aws 中获取配置的 S3 存储桶以获取详细的计费报告

问题描述

我想用 python 和 boto3 查询配置的 s3 存储桶,以获取 aws 帐户内的详细计费报告。boto3 文档中列出了 describe_report_definitions 命令,该命令应使用配置的 s3 存储桶返回可用报告。当我运行以下代码时,我一直收到一个空数组作为响应,尽管配置了 s3 存储桶,但报告可用。

    cur_client = boto3.client(
            'cur',
            'us-east-1'
    )

    cur_describe_report_definitions_response = cur_client.describe_report_definitions()
    print(str(json.dumps(cur_describe_report_definitions_response['ReportDefinitions'])))

    #Response
    []

目标是获取配置的 s3 存储桶名称。 在此处输入图像描述

标签: pythonamazon-web-servicesamazon-s3boto3aws-billing

解决方案


推荐阅读