0

I would like to query with python and boto3 the configured s3 bucket for the detailed billing reports inside the aws account. There is the command describe_report_definitions listed inside the boto3 docs which should return the available reports with the configured s3 bucket. When I run the following code I receive all the time an empty array as response although a s3 bucket is configured an reports are available.

    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
    []

The goal is to get the configured s3 bucket name. enter image description here

Patrick
  • 2,128
  • 16
  • 24
  • The bucket doesn't change, why would you need to get the bucket name programmatically? What's your use-case? – Dvir669 Mar 03 '20 at 22:01
  • I need to collect the generated reports inside this buckets over multiple accounts. So it would be more convenient to read out the bucket name automatically. – Patrick Mar 04 '20 at 06:22
  • You can't use AWS organizations? Using one consolidated account to manage those accounts? – Dvir669 Mar 04 '20 at 10:15
  • We use this but there are more than one organization. – Patrick Mar 04 '20 at 10:31
  • just print the response, why do you need json.dumps? or `cur_describe_report_definitions_response['ReportDefinitions']['S3Bucket']` – Lamanus Mar 08 '20 at 04:24
  • As I wrote in the post: I receive all the time an empyt array as response. Therefore if I would print `cur_describe_report_definitions_response['ReportDefinitions']['S3Bucket']` there would be an error that the key 'S3Bucket' does not exists inside the 'ReportDefinitions'. – Patrick Mar 10 '20 at 08:08

0 Answers0