AWS Billing and Cost Management Data Exports

2023/11/27 - AWS Billing and Cost Management Data Exports - 12 new api methods

Changes  Users can create, read, update, delete Exports of billing and cost management data. Users can get details of Export Executions and details of Tables for exporting. Tagging support is provided for Exports

DeleteExport (new) Link ¶

Deletes an existing data export.

See also: AWS API Documentation

Request Syntax

client.delete_export(
    ExportArn='string'
)
type ExportArn

string

param ExportArn

[REQUIRED]

The Amazon Resource Name (ARN) for this export.

rtype

dict

returns

Response Syntax

{
    'ExportArn': 'string'
}

Response Structure

  • (dict) --

    • ExportArn (string) --

      The Amazon Resource Name (ARN) for this export.

CreateExport (new) Link ¶

Creates a data export and specifies the data query, the delivery preference, and any optional resource tags.

A DataQuery consists of both a QueryStatement and TableConfigurations .

The QueryStatement is an SQL statement. Data Exports only supports a limited subset of the SQL syntax. For more information on the SQL syntax that is supported, see Data query. To view the available tables and columns, see the Data Exports table dictionary.

The TableConfigurations is a collection of specified TableProperties for the table being queried in the QueryStatement . TableProperties are additional configurations you can provide to change the data and schema of a table. Each table can have different TableProperties. However, tables are not required to have any TableProperties. Each table property has a default value that it assumes if not specified. For more information on table configurations, see Data query. To view the table properties available for each table, see the Data Exports table dictionary or use the ListTables API to get a response of all tables and their available properties.

See also: AWS API Documentation

Request Syntax

client.create_export(
    Export={
        'DataQuery': {
            'QueryStatement': 'string',
            'TableConfigurations': {
                'string': {
                    'string': 'string'
                }
            }
        },
        'Description': 'string',
        'DestinationConfigurations': {
            'S3Destination': {
                'S3Bucket': 'string',
                'S3OutputConfigurations': {
                    'Compression': 'GZIP'|'PARQUET',
                    'Format': 'TEXT_OR_CSV'|'PARQUET',
                    'OutputType': 'CUSTOM',
                    'Overwrite': 'CREATE_NEW_REPORT'|'OVERWRITE_REPORT'
                },
                'S3Prefix': 'string',
                'S3Region': 'string'
            }
        },
        'ExportArn': 'string',
        'Name': 'string',
        'RefreshCadence': {
            'Frequency': 'SYNCHRONOUS'
        }
    },
    ResourceTags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type Export

dict

param Export

[REQUIRED]

The details of the export, including data query, name, description, and destination configuration.

  • DataQuery (dict) -- [REQUIRED]

    The data query for this specific data export.

    • QueryStatement (string) -- [REQUIRED]

      The query statement.

    • TableConfigurations (dict) --

      The table configuration.

      • (string) --

        • (dict) --

          • (string) --

            • (string) --

  • Description (string) --

    The description for this specific data export.

  • DestinationConfigurations (dict) -- [REQUIRED]

    The destination configuration for this specific data export.

    • S3Destination (dict) -- [REQUIRED]

      An object that describes the destination of the data exports file.

      • S3Bucket (string) -- [REQUIRED]

        The name of the Amazon S3 bucket used as the destination of a data export file.

      • S3OutputConfigurations (dict) -- [REQUIRED]

        The output configuration for the data export.

        • Compression (string) -- [REQUIRED]

          The compression type for the data export.

        • Format (string) -- [REQUIRED]

          The file format for the data export.

        • OutputType (string) -- [REQUIRED]

          The output type for the data export.

        • Overwrite (string) -- [REQUIRED]

          The rule to follow when generating a version of the data export file. You have the choice to overwrite the previous version or to be delivered in addition to the previous versions. Overwriting exports can save on Amazon S3 storage costs. Creating new export versions allows you to track the changes in cost and usage data over time.

      • S3Prefix (string) -- [REQUIRED]

        The S3 path prefix you want prepended to the name of your data export.

      • S3Region (string) -- [REQUIRED]

        The S3 bucket Region.

  • ExportArn (string) --

    The Amazon Resource Name (ARN) for this export.

  • Name (string) -- [REQUIRED]

    The name of this specific data export.

  • RefreshCadence (dict) -- [REQUIRED]

    The cadence for Amazon Web Services to update the export in your S3 bucket.

    • Frequency (string) -- [REQUIRED]

      The frequency that data exports are updated. The export refreshes each time the source data updates, up to three times daily.

type ResourceTags

list

param ResourceTags

An optional list of tags to associate with the specified export. Each tag consists of a key and a value, and each key must be unique for the resource.

  • (dict) --

    The tag structure that contains a tag key and value.

    • Key (string) -- [REQUIRED]

      The key that's associated with the tag.

    • Value (string) -- [REQUIRED]

      The value that's associated with the tag.

rtype

dict

returns

Response Syntax

{
    'ExportArn': 'string'
}

Response Structure

  • (dict) --

    • ExportArn (string) --

      The Amazon Resource Name (ARN) for this export.

ListExports (new) Link ¶

Lists all data export definitions.

See also: AWS API Documentation

Request Syntax

client.list_exports(
    MaxResults=123,
    NextToken='string'
)
type MaxResults

integer

param MaxResults

The maximum number of objects that are returned for the request.

type NextToken

string

param NextToken

The token to retrieve the next set of results.

rtype

dict

returns

Response Syntax

{
    'Exports': [
        {
            'ExportArn': 'string',
            'ExportName': 'string',
            'ExportStatus': {
                'CreatedAt': datetime(2015, 1, 1),
                'LastRefreshedAt': datetime(2015, 1, 1),
                'LastUpdatedAt': datetime(2015, 1, 1),
                'StatusCode': 'HEALTHY'|'UNHEALTHY',
                'StatusReason': 'INSUFFICIENT_PERMISSION'|'BILL_OWNER_CHANGED'|'INTERNAL_FAILURE'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Exports (list) --

      The details of the exports, including name and export status.

      • (dict) --

        The reference details for a given export.

        • ExportArn (string) --

          The Amazon Resource Name (ARN) for this export.

        • ExportName (string) --

          The name of this specific data export.

        • ExportStatus (dict) --

          The status of this specific data export.

          • CreatedAt (datetime) --

            The timestamp of when the export was created.

          • LastRefreshedAt (datetime) --

            The timestamp of when the export was last generated.

          • LastUpdatedAt (datetime) --

            The timestamp of when the export was updated.

          • StatusCode (string) --

            The status code for the request.

          • StatusReason (string) --

            The description for the status code.

    • NextToken (string) --

      The token to retrieve the next set of results.

UpdateExport (new) Link ¶

Updates an existing data export by overwriting all export parameters. All export parameters must be provided in the UpdateExport request.

See also: AWS API Documentation

Request Syntax

client.update_export(
    Export={
        'DataQuery': {
            'QueryStatement': 'string',
            'TableConfigurations': {
                'string': {
                    'string': 'string'
                }
            }
        },
        'Description': 'string',
        'DestinationConfigurations': {
            'S3Destination': {
                'S3Bucket': 'string',
                'S3OutputConfigurations': {
                    'Compression': 'GZIP'|'PARQUET',
                    'Format': 'TEXT_OR_CSV'|'PARQUET',
                    'OutputType': 'CUSTOM',
                    'Overwrite': 'CREATE_NEW_REPORT'|'OVERWRITE_REPORT'
                },
                'S3Prefix': 'string',
                'S3Region': 'string'
            }
        },
        'ExportArn': 'string',
        'Name': 'string',
        'RefreshCadence': {
            'Frequency': 'SYNCHRONOUS'
        }
    },
    ExportArn='string'
)
type Export

dict

param Export

[REQUIRED]

The name and query details for the export.

  • DataQuery (dict) -- [REQUIRED]

    The data query for this specific data export.

    • QueryStatement (string) -- [REQUIRED]

      The query statement.

    • TableConfigurations (dict) --

      The table configuration.

      • (string) --

        • (dict) --

          • (string) --

            • (string) --

  • Description (string) --

    The description for this specific data export.

  • DestinationConfigurations (dict) -- [REQUIRED]

    The destination configuration for this specific data export.

    • S3Destination (dict) -- [REQUIRED]

      An object that describes the destination of the data exports file.

      • S3Bucket (string) -- [REQUIRED]

        The name of the Amazon S3 bucket used as the destination of a data export file.

      • S3OutputConfigurations (dict) -- [REQUIRED]

        The output configuration for the data export.

        • Compression (string) -- [REQUIRED]

          The compression type for the data export.

        • Format (string) -- [REQUIRED]

          The file format for the data export.

        • OutputType (string) -- [REQUIRED]

          The output type for the data export.

        • Overwrite (string) -- [REQUIRED]

          The rule to follow when generating a version of the data export file. You have the choice to overwrite the previous version or to be delivered in addition to the previous versions. Overwriting exports can save on Amazon S3 storage costs. Creating new export versions allows you to track the changes in cost and usage data over time.

      • S3Prefix (string) -- [REQUIRED]

        The S3 path prefix you want prepended to the name of your data export.

      • S3Region (string) -- [REQUIRED]

        The S3 bucket Region.

  • ExportArn (string) --

    The Amazon Resource Name (ARN) for this export.

  • Name (string) -- [REQUIRED]

    The name of this specific data export.

  • RefreshCadence (dict) -- [REQUIRED]

    The cadence for Amazon Web Services to update the export in your S3 bucket.

    • Frequency (string) -- [REQUIRED]

      The frequency that data exports are updated. The export refreshes each time the source data updates, up to three times daily.

type ExportArn

string

param ExportArn

[REQUIRED]

The Amazon Resource Name (ARN) for this export.

rtype

dict

returns

Response Syntax

{
    'ExportArn': 'string'
}

Response Structure

  • (dict) --

    • ExportArn (string) --

      The Amazon Resource Name (ARN) for this export.

ListTagsForResource (new) Link ¶

List tags associated with an existing data export.

See also: AWS API Documentation

Request Syntax

client.list_tags_for_resource(
    MaxResults=123,
    NextToken='string',
    ResourceArn='string'
)
type MaxResults

integer

param MaxResults

The maximum number of objects that are returned for the request.

type NextToken

string

param NextToken

The token to retrieve the next set of results.

type ResourceArn

string

param ResourceArn

[REQUIRED]

The unique identifier for the resource.

rtype

dict

returns

Response Syntax

{
    'NextToken': 'string',
    'ResourceTags': [
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • NextToken (string) --

      The token to retrieve the next set of results.

    • ResourceTags (list) --

      An optional list of tags to associate with the specified export. Each tag consists of a key and a value, and each key must be unique for the resource.

      • (dict) --

        The tag structure that contains a tag key and value.

        • Key (string) --

          The key that's associated with the tag.

        • Value (string) --

          The value that's associated with the tag.

GetExecution (new) Link ¶

Exports data based on the source data update.

See also: AWS API Documentation

Request Syntax

client.get_execution(
    ExecutionId='string',
    ExportArn='string'
)
type ExecutionId

string

param ExecutionId

[REQUIRED]

The ID for this specific execution.

type ExportArn

string

param ExportArn

[REQUIRED]

The Amazon Resource Name (ARN) of the Export object that generated this specific execution.

rtype

dict

returns

Response Syntax

{
    'ExecutionId': 'string',
    'ExecutionStatus': {
        'CompletedAt': datetime(2015, 1, 1),
        'CreatedAt': datetime(2015, 1, 1),
        'LastUpdatedAt': datetime(2015, 1, 1),
        'StatusCode': 'INITIATION_IN_PROCESS'|'QUERY_QUEUED'|'QUERY_IN_PROCESS'|'QUERY_FAILURE'|'DELIVERY_IN_PROCESS'|'DELIVERY_SUCCESS'|'DELIVERY_FAILURE',
        'StatusReason': 'INSUFFICIENT_PERMISSION'|'BILL_OWNER_CHANGED'|'INTERNAL_FAILURE'
    },
    'Export': {
        'DataQuery': {
            'QueryStatement': 'string',
            'TableConfigurations': {
                'string': {
                    'string': 'string'
                }
            }
        },
        'Description': 'string',
        'DestinationConfigurations': {
            'S3Destination': {
                'S3Bucket': 'string',
                'S3OutputConfigurations': {
                    'Compression': 'GZIP'|'PARQUET',
                    'Format': 'TEXT_OR_CSV'|'PARQUET',
                    'OutputType': 'CUSTOM',
                    'Overwrite': 'CREATE_NEW_REPORT'|'OVERWRITE_REPORT'
                },
                'S3Prefix': 'string',
                'S3Region': 'string'
            }
        },
        'ExportArn': 'string',
        'Name': 'string',
        'RefreshCadence': {
            'Frequency': 'SYNCHRONOUS'
        }
    }
}

Response Structure

  • (dict) --

    • ExecutionId (string) --

      The ID for this specific execution.

    • ExecutionStatus (dict) --

      The status of this specific execution.

      • CompletedAt (datetime) --

        The time when the execution was completed.

      • CreatedAt (datetime) --

        The time when the execution was created.

      • LastUpdatedAt (datetime) --

        The time when the execution was last updated.

      • StatusCode (string) --

        The code for the status of the execution.

      • StatusReason (string) --

        The reason for the failed status.

    • Export (dict) --

      The export data for this specific execution. This export data is a snapshot from when the execution was generated. The data could be different from the current export data if the export was updated since the execution was generated.

      • DataQuery (dict) --

        The data query for this specific data export.

        • QueryStatement (string) --

          The query statement.

        • TableConfigurations (dict) --

          The table configuration.

          • (string) --

            • (dict) --

              • (string) --

                • (string) --

      • Description (string) --

        The description for this specific data export.

      • DestinationConfigurations (dict) --

        The destination configuration for this specific data export.

        • S3Destination (dict) --

          An object that describes the destination of the data exports file.

          • S3Bucket (string) --

            The name of the Amazon S3 bucket used as the destination of a data export file.

          • S3OutputConfigurations (dict) --

            The output configuration for the data export.

            • Compression (string) --

              The compression type for the data export.

            • Format (string) --

              The file format for the data export.

            • OutputType (string) --

              The output type for the data export.

            • Overwrite (string) --

              The rule to follow when generating a version of the data export file. You have the choice to overwrite the previous version or to be delivered in addition to the previous versions. Overwriting exports can save on Amazon S3 storage costs. Creating new export versions allows you to track the changes in cost and usage data over time.

          • S3Prefix (string) --

            The S3 path prefix you want prepended to the name of your data export.

          • S3Region (string) --

            The S3 bucket Region.

      • ExportArn (string) --

        The Amazon Resource Name (ARN) for this export.

      • Name (string) --

        The name of this specific data export.

      • RefreshCadence (dict) --

        The cadence for Amazon Web Services to update the export in your S3 bucket.

        • Frequency (string) --

          The frequency that data exports are updated. The export refreshes each time the source data updates, up to three times daily.

ListTables (new) Link ¶

Lists all available tables in data exports.

See also: AWS API Documentation

Request Syntax

client.list_tables(
    MaxResults=123,
    NextToken='string'
)
type MaxResults

integer

param MaxResults

The maximum number of objects that are returned for the request.

type NextToken

string

param NextToken

The token to retrieve the next set of results.

rtype

dict

returns

Response Syntax

{
    'NextToken': 'string',
    'Tables': [
        {
            'Description': 'string',
            'TableName': 'string',
            'TableProperties': [
                {
                    'DefaultValue': 'string',
                    'Description': 'string',
                    'Name': 'string',
                    'ValidValues': [
                        'string',
                    ]
                },
            ]
        },
    ]
}

Response Structure

  • (dict) --

    • NextToken (string) --

      The token to retrieve the next set of results.

    • Tables (list) --

      The list of tables.

      • (dict) --

        The details for the data export table.

        • Description (string) --

          The description for the table.

        • TableName (string) --

          The name of the table.

        • TableProperties (list) --

          The properties for the table.

          • (dict) --

            The properties for the data export table.

            • DefaultValue (string) --

              The default value for the table.

            • Description (string) --

              The description for the table.

            • Name (string) --

              The name of the table.

            • ValidValues (list) --

              The valid values for the table.

              • (string) --

ListExecutions (new) Link ¶

Lists the historical executions for the export.

See also: AWS API Documentation

Request Syntax

client.list_executions(
    ExportArn='string',
    MaxResults=123,
    NextToken='string'
)
type ExportArn

string

param ExportArn

[REQUIRED]

The Amazon Resource Name (ARN) for this export.

type MaxResults

integer

param MaxResults

The maximum number of objects that are returned for the request.

type NextToken

string

param NextToken

The token to retrieve the next set of results.

rtype

dict

returns

Response Syntax

{
    'Executions': [
        {
            'ExecutionId': 'string',
            'ExecutionStatus': {
                'CompletedAt': datetime(2015, 1, 1),
                'CreatedAt': datetime(2015, 1, 1),
                'LastUpdatedAt': datetime(2015, 1, 1),
                'StatusCode': 'INITIATION_IN_PROCESS'|'QUERY_QUEUED'|'QUERY_IN_PROCESS'|'QUERY_FAILURE'|'DELIVERY_IN_PROCESS'|'DELIVERY_SUCCESS'|'DELIVERY_FAILURE',
                'StatusReason': 'INSUFFICIENT_PERMISSION'|'BILL_OWNER_CHANGED'|'INTERNAL_FAILURE'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Executions (list) --

      The list of executions.

      • (dict) --

        The reference for the data export update.

        • ExecutionId (string) --

          The ID for this specific execution.

        • ExecutionStatus (dict) --

          The status of this specific execution.

          • CompletedAt (datetime) --

            The time when the execution was completed.

          • CreatedAt (datetime) --

            The time when the execution was created.

          • LastUpdatedAt (datetime) --

            The time when the execution was last updated.

          • StatusCode (string) --

            The code for the status of the execution.

          • StatusReason (string) --

            The reason for the failed status.

    • NextToken (string) --

      The token to retrieve the next set of results.

GetExport (new) Link ¶

Views the definition of an existing data export.

See also: AWS API Documentation

Request Syntax

client.get_export(
    ExportArn='string'
)
type ExportArn

string

param ExportArn

[REQUIRED]

The Amazon Resource Name (ARN) for this export.

rtype

dict

returns

Response Syntax

{
    'Export': {
        'DataQuery': {
            'QueryStatement': 'string',
            'TableConfigurations': {
                'string': {
                    'string': 'string'
                }
            }
        },
        'Description': 'string',
        'DestinationConfigurations': {
            'S3Destination': {
                'S3Bucket': 'string',
                'S3OutputConfigurations': {
                    'Compression': 'GZIP'|'PARQUET',
                    'Format': 'TEXT_OR_CSV'|'PARQUET',
                    'OutputType': 'CUSTOM',
                    'Overwrite': 'CREATE_NEW_REPORT'|'OVERWRITE_REPORT'
                },
                'S3Prefix': 'string',
                'S3Region': 'string'
            }
        },
        'ExportArn': 'string',
        'Name': 'string',
        'RefreshCadence': {
            'Frequency': 'SYNCHRONOUS'
        }
    },
    'ExportStatus': {
        'CreatedAt': datetime(2015, 1, 1),
        'LastRefreshedAt': datetime(2015, 1, 1),
        'LastUpdatedAt': datetime(2015, 1, 1),
        'StatusCode': 'HEALTHY'|'UNHEALTHY',
        'StatusReason': 'INSUFFICIENT_PERMISSION'|'BILL_OWNER_CHANGED'|'INTERNAL_FAILURE'
    }
}

Response Structure

  • (dict) --

    • Export (dict) --

      The data for this specific export.

      • DataQuery (dict) --

        The data query for this specific data export.

        • QueryStatement (string) --

          The query statement.

        • TableConfigurations (dict) --

          The table configuration.

          • (string) --

            • (dict) --

              • (string) --

                • (string) --

      • Description (string) --

        The description for this specific data export.

      • DestinationConfigurations (dict) --

        The destination configuration for this specific data export.

        • S3Destination (dict) --

          An object that describes the destination of the data exports file.

          • S3Bucket (string) --

            The name of the Amazon S3 bucket used as the destination of a data export file.

          • S3OutputConfigurations (dict) --

            The output configuration for the data export.

            • Compression (string) --

              The compression type for the data export.

            • Format (string) --

              The file format for the data export.

            • OutputType (string) --

              The output type for the data export.

            • Overwrite (string) --

              The rule to follow when generating a version of the data export file. You have the choice to overwrite the previous version or to be delivered in addition to the previous versions. Overwriting exports can save on Amazon S3 storage costs. Creating new export versions allows you to track the changes in cost and usage data over time.

          • S3Prefix (string) --

            The S3 path prefix you want prepended to the name of your data export.

          • S3Region (string) --

            The S3 bucket Region.

      • ExportArn (string) --

        The Amazon Resource Name (ARN) for this export.

      • Name (string) --

        The name of this specific data export.

      • RefreshCadence (dict) --

        The cadence for Amazon Web Services to update the export in your S3 bucket.

        • Frequency (string) --

          The frequency that data exports are updated. The export refreshes each time the source data updates, up to three times daily.

    • ExportStatus (dict) --

      The status of this specific export.

      • CreatedAt (datetime) --

        The timestamp of when the export was created.

      • LastRefreshedAt (datetime) --

        The timestamp of when the export was last generated.

      • LastUpdatedAt (datetime) --

        The timestamp of when the export was updated.

      • StatusCode (string) --

        The status code for the request.

      • StatusReason (string) --

        The description for the status code.

UntagResource (new) Link ¶

Deletes tags associated with an existing data export definition.

See also: AWS API Documentation

Request Syntax

client.untag_resource(
    ResourceArn='string',
    ResourceTagKeys=[
        'string',
    ]
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

The unique identifier for the resource.

type ResourceTagKeys

list

param ResourceTagKeys

[REQUIRED]

The tag keys that are associated with the resource ARN.

  • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

GetTable (new) Link ¶

Returns the metadata for the specified table and table properties. This includes the list of columns in the table schema, their data types, and column descriptions.

See also: AWS API Documentation

Request Syntax

client.get_table(
    TableName='string',
    TableProperties={
        'string': 'string'
    }
)
type TableName

string

param TableName

[REQUIRED]

The name of the table.

type TableProperties

dict

param TableProperties

TableProperties are additional configurations you can provide to change the data and schema of a table. Each table can have different TableProperties. Tables are not required to have any TableProperties. Each table property has a default value that it assumes if not specified.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'Description': 'string',
    'Schema': [
        {
            'Description': 'string',
            'Name': 'string',
            'Type': 'string'
        },
    ],
    'TableName': 'string',
    'TableProperties': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    • Description (string) --

      The table description.

    • Schema (list) --

      The schema of the table.

      • (dict) --

        Includes basic information for a data column such as its description, name, and type.

        • Description (string) --

          The description for a column.

        • Name (string) --

          The column name.

        • Type (string) --

          The kind of data a column stores.

    • TableName (string) --

      The name of the table.

    • TableProperties (dict) --

      TableProperties are additional configurations you can provide to change the data and schema of a table. Each table can have different TableProperties. Tables are not required to have any TableProperties. Each table property has a default value that it assumes if not specified.

      • (string) --

        • (string) --

TagResource (new) Link ¶

Adds tags for an existing data export definition.

See also: AWS API Documentation

Request Syntax

client.tag_resource(
    ResourceArn='string',
    ResourceTags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

The unique identifier for the resource.

type ResourceTags

list

param ResourceTags

[REQUIRED]

The tags to associate with the resource. Each tag consists of a key and a value, and each key must be unique for the resource.

  • (dict) --

    The tag structure that contains a tag key and value.

    • Key (string) -- [REQUIRED]

      The key that's associated with the tag.

    • Value (string) -- [REQUIRED]

      The value that's associated with the tag.

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --