AWS Billing

2025/09/26 - AWS Billing - 2 new5 updated api methods

Changes  Add ability to combine custom billing views to create new consolidated views.

DisassociateSourceViews (new) Link ¶

Removes the association between one or more source billing views and an existing billing view. This allows modifying the composition of aggregate billing views.

See also: AWS API Documentation

Request Syntax

client.disassociate_source_views(
    arn='string',
    sourceViews=[
        'string',
    ]
)
type arn:

string

param arn:

[REQUIRED]

The Amazon Resource Name (ARN) of the billing view to disassociate source views from.

type sourceViews:

list

param sourceViews:

[REQUIRED]

A list of ARNs of the source billing views to disassociate.

  • (string) --

rtype:

dict

returns:

Response Syntax

{
    'arn': 'string'
}

Response Structure

  • (dict) --

    • arn (string) --

      The ARN of the billing view that the source views were disassociated from.

AssociateSourceViews (new) Link ¶

Associates one or more source billing views with an existing billing view. This allows creating aggregate billing views that combine data from multiple sources.

See also: AWS API Documentation

Request Syntax

client.associate_source_views(
    arn='string',
    sourceViews=[
        'string',
    ]
)
type arn:

string

param arn:

[REQUIRED]

The Amazon Resource Name (ARN) of the billing view to associate source views with.

type sourceViews:

list

param sourceViews:

[REQUIRED]

A list of ARNs of the source billing views to associate.

  • (string) --

rtype:

dict

returns:

Response Syntax

{
    'arn': 'string'
}

Response Structure

  • (dict) --

    • arn (string) --

      The ARN of the billing view that the source views were associated with.

CreateBillingView (updated) Link ¶
Changes (request)
{'dataFilterExpression': {'timeRange': {'beginDateInclusive': 'timestamp',
                                        'endDateInclusive': 'timestamp'}}}

Creates a billing view with the specified billing view attributes.

See also: AWS API Documentation

Request Syntax

client.create_billing_view(
    name='string',
    description='string',
    sourceViews=[
        'string',
    ],
    dataFilterExpression={
        'dimensions': {
            'key': 'LINKED_ACCOUNT',
            'values': [
                'string',
            ]
        },
        'tags': {
            'key': 'string',
            'values': [
                'string',
            ]
        },
        'timeRange': {
            'beginDateInclusive': datetime(2015, 1, 1),
            'endDateInclusive': datetime(2015, 1, 1)
        }
    },
    clientToken='string',
    resourceTags=[
        {
            'key': 'string',
            'value': 'string'
        },
    ]
)
type name:

string

param name:

[REQUIRED]

The name of the billing view.

type description:

string

param description:

The description of the billing view.

type sourceViews:

list

param sourceViews:

[REQUIRED]

A list of billing views used as the data source for the custom billing view.

  • (string) --

type dataFilterExpression:

dict

param dataFilterExpression:

See Expression. Billing view only supports LINKED_ACCOUNT and Tags.

  • dimensions (dict) --

    The specific Dimension to use for Expression.

    • key (string) -- [REQUIRED]

      The names of the metadata types that you can use to filter and group your results.

    • values (list) -- [REQUIRED]

      The metadata values that you can use to filter and group your results.

      • (string) --

  • tags (dict) --

    The specific Tag to use for Expression.

    • key (string) -- [REQUIRED]

      The key for the tag.

    • values (list) -- [REQUIRED]

      The specific value of the tag.

      • (string) --

  • timeRange (dict) --

    Specifies a time range filter for the billing view data.

    • beginDateInclusive (datetime) --

      The inclusive start date of the time range.

    • endDateInclusive (datetime) --

      The inclusive end date of the time range.

type clientToken:

string

param clientToken:

A unique, case-sensitive identifier you specify to ensure idempotency of the request. Idempotency ensures that an API request completes no more than one time. If the original request completes successfully, any subsequent retries complete successfully without performing any further actions with an idempotent request.

This field is autopopulated if not provided.

type resourceTags:

list

param resourceTags:

A list of key value map specifying tags associated to the billing view being created.

  • (dict) --

    The tag structure that contains a tag key and value.

    • key (string) -- [REQUIRED]

      The key that's associated with the tag.

    • value (string) --

      The value that's associated with the tag.

rtype:

dict

returns:

Response Syntax

{
    'arn': 'string',
    'createdAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • arn (string) --

      The Amazon Resource Name (ARN) that can be used to uniquely identify the billing view.

    • createdAt (datetime) --

      The time when the billing view was created.

DeleteBillingView (updated) Link ¶
Changes (request)
{'force': 'boolean'}

Deletes the specified billing view.

See also: AWS API Documentation

Request Syntax

client.delete_billing_view(
    arn='string',
    force=True|False
)
type arn:

string

param arn:

[REQUIRED]

The Amazon Resource Name (ARN) that can be used to uniquely identify the billing view.

type force:

boolean

param force:

If set to true, forces deletion of the billing view even if it has derived resources (e.g. other billing views or budgets). Use with caution as this may break dependent resources.

rtype:

dict

returns:

Response Syntax

{
    'arn': 'string'
}

Response Structure

  • (dict) --

    • arn (string) --

      The Amazon Resource Name (ARN) that can be used to uniquely identify the billing view.

GetBillingView (updated) Link ¶
Changes (response)
{'billingView': {'dataFilterExpression': {'timeRange': {'beginDateInclusive': 'timestamp',
                                                        'endDateInclusive': 'timestamp'}},
                 'derivedViewCount': 'integer',
                 'healthStatus': {'statusCode': 'HEALTHY | UNHEALTHY | '
                                                'CREATING | UPDATING',
                                  'statusReasons': ['SOURCE_VIEW_UNHEALTHY | '
                                                    'SOURCE_VIEW_UPDATING | '
                                                    'SOURCE_VIEW_ACCESS_DENIED '
                                                    '| SOURCE_VIEW_NOT_FOUND | '
                                                    'CYCLIC_DEPENDENCY | '
                                                    'SOURCE_VIEW_DEPTH_EXCEEDED '
                                                    '| AGGREGATE_SOURCE | '
                                                    'VIEW_OWNER_NOT_MANAGEMENT_ACCOUNT']},
                 'sourceAccountId': 'string',
                 'sourceViewCount': 'integer',
                 'viewDefinitionLastUpdatedAt': 'timestamp'}}

Returns the metadata associated to the specified billing view ARN.

See also: AWS API Documentation

Request Syntax

client.get_billing_view(
    arn='string'
)
type arn:

string

param arn:

[REQUIRED]

The Amazon Resource Name (ARN) that can be used to uniquely identify the billing view.

rtype:

dict

returns:

Response Syntax

{
    'billingView': {
        'arn': 'string',
        'name': 'string',
        'description': 'string',
        'billingViewType': 'PRIMARY'|'BILLING_GROUP'|'CUSTOM',
        'ownerAccountId': 'string',
        'sourceAccountId': 'string',
        'dataFilterExpression': {
            'dimensions': {
                'key': 'LINKED_ACCOUNT',
                'values': [
                    'string',
                ]
            },
            'tags': {
                'key': 'string',
                'values': [
                    'string',
                ]
            },
            'timeRange': {
                'beginDateInclusive': datetime(2015, 1, 1),
                'endDateInclusive': datetime(2015, 1, 1)
            }
        },
        'createdAt': datetime(2015, 1, 1),
        'updatedAt': datetime(2015, 1, 1),
        'derivedViewCount': 123,
        'sourceViewCount': 123,
        'viewDefinitionLastUpdatedAt': datetime(2015, 1, 1),
        'healthStatus': {
            'statusCode': 'HEALTHY'|'UNHEALTHY'|'CREATING'|'UPDATING',
            'statusReasons': [
                'SOURCE_VIEW_UNHEALTHY'|'SOURCE_VIEW_UPDATING'|'SOURCE_VIEW_ACCESS_DENIED'|'SOURCE_VIEW_NOT_FOUND'|'CYCLIC_DEPENDENCY'|'SOURCE_VIEW_DEPTH_EXCEEDED'|'AGGREGATE_SOURCE'|'VIEW_OWNER_NOT_MANAGEMENT_ACCOUNT',
            ]
        }
    }
}

Response Structure

  • (dict) --

    • billingView (dict) --

      The billing view element associated with the specified ARN.

      • arn (string) --

        The Amazon Resource Name (ARN) that can be used to uniquely identify the billing view.

      • name (string) --

        The account name of the billing view.

      • description (string) --

        The description of the billing view.

      • billingViewType (string) --

        The type of billing group.

      • ownerAccountId (string) --

        The account owner of the billing view.

      • sourceAccountId (string) --

        The Amazon Web Services account ID that owns the source billing view, if this is a derived billing view.

      • dataFilterExpression (dict) --

        See Expression. Billing view only supports LINKED_ACCOUNT and Tags.

        • dimensions (dict) --

          The specific Dimension to use for Expression.

          • key (string) --

            The names of the metadata types that you can use to filter and group your results.

          • values (list) --

            The metadata values that you can use to filter and group your results.

            • (string) --

        • tags (dict) --

          The specific Tag to use for Expression.

          • key (string) --

            The key for the tag.

          • values (list) --

            The specific value of the tag.

            • (string) --

        • timeRange (dict) --

          Specifies a time range filter for the billing view data.

          • beginDateInclusive (datetime) --

            The inclusive start date of the time range.

          • endDateInclusive (datetime) --

            The inclusive end date of the time range.

      • createdAt (datetime) --

        The time when the billing view was created.

      • updatedAt (datetime) --

        The time when the billing view was last updated.

      • derivedViewCount (integer) --

        The number of billing views that use this billing view as a source.

      • sourceViewCount (integer) --

        The number of source views associated with this billing view.

      • viewDefinitionLastUpdatedAt (datetime) --

        The timestamp of when the billing view definition was last updated.

      • healthStatus (dict) --

        The current health status of the billing view.

        • statusCode (string) --

          The current health status code of the billing view.

        • statusReasons (list) --

          A list of reasons explaining the current health status, if applicable.

          • (string) --

ListBillingViews (updated) Link ¶
Changes (request, response)
Request
{'sourceAccountId': 'string'}
Response
{'billingViews': {'healthStatus': {'statusCode': 'HEALTHY | UNHEALTHY | '
                                                 'CREATING | UPDATING',
                                   'statusReasons': ['SOURCE_VIEW_UNHEALTHY | '
                                                     'SOURCE_VIEW_UPDATING | '
                                                     'SOURCE_VIEW_ACCESS_DENIED '
                                                     '| SOURCE_VIEW_NOT_FOUND '
                                                     '| CYCLIC_DEPENDENCY | '
                                                     'SOURCE_VIEW_DEPTH_EXCEEDED '
                                                     '| AGGREGATE_SOURCE | '
                                                     'VIEW_OWNER_NOT_MANAGEMENT_ACCOUNT']},
                  'sourceAccountId': 'string'}}

Lists the billing views available for a given time period.

Every Amazon Web Services account has a unique PRIMARY billing view that represents the billing data available by default. Accounts that use Billing Conductor also have BILLING_GROUP billing views representing pro forma costs associated with each created billing group.

See also: AWS API Documentation

Request Syntax

client.list_billing_views(
    activeTimeRange={
        'activeAfterInclusive': datetime(2015, 1, 1),
        'activeBeforeInclusive': datetime(2015, 1, 1)
    },
    arns=[
        'string',
    ],
    billingViewTypes=[
        'PRIMARY'|'BILLING_GROUP'|'CUSTOM',
    ],
    ownerAccountId='string',
    sourceAccountId='string',
    maxResults=123,
    nextToken='string'
)
type activeTimeRange:

dict

param activeTimeRange:

The time range for the billing views listed. PRIMARY billing view is always listed. BILLING_GROUP billing views are listed for time ranges when the associated billing group resource in Billing Conductor is active. The time range must be within one calendar month.

  • activeAfterInclusive (datetime) -- [REQUIRED]

    The inclusive time range start date.

  • activeBeforeInclusive (datetime) -- [REQUIRED]

    The inclusive time range end date.

type arns:

list

param arns:

The Amazon Resource Name (ARN) that can be used to uniquely identify the billing view.

  • (string) --

type billingViewTypes:

list

param billingViewTypes:

The type of billing view.

  • (string) --

type ownerAccountId:

string

param ownerAccountId:

The list of owners of the billing view.

type sourceAccountId:

string

param sourceAccountId:

Filters the results to include only billing views that use the specified account as a source.

type maxResults:

integer

param maxResults:

The maximum number of billing views to retrieve. Default is 100.

type nextToken:

string

param nextToken:

The pagination token that is used on subsequent calls to list billing views.

rtype:

dict

returns:

Response Syntax

{
    'billingViews': [
        {
            'arn': 'string',
            'name': 'string',
            'description': 'string',
            'ownerAccountId': 'string',
            'sourceAccountId': 'string',
            'billingViewType': 'PRIMARY'|'BILLING_GROUP'|'CUSTOM',
            'healthStatus': {
                'statusCode': 'HEALTHY'|'UNHEALTHY'|'CREATING'|'UPDATING',
                'statusReasons': [
                    'SOURCE_VIEW_UNHEALTHY'|'SOURCE_VIEW_UPDATING'|'SOURCE_VIEW_ACCESS_DENIED'|'SOURCE_VIEW_NOT_FOUND'|'CYCLIC_DEPENDENCY'|'SOURCE_VIEW_DEPTH_EXCEEDED'|'AGGREGATE_SOURCE'|'VIEW_OWNER_NOT_MANAGEMENT_ACCOUNT',
                ]
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • billingViews (list) --

      A list of BillingViewListElement retrieved.

      • (dict) --

        A representation of a billing view.

        • arn (string) --

          The Amazon Resource Name (ARN) that can be used to uniquely identify the billing view.

        • name (string) --

          A list of names of the Billing view.

        • description (string) --

          The description of the billing view.

        • ownerAccountId (string) --

          The list of owners of the Billing view.

        • sourceAccountId (string) --

          The Amazon Web Services account ID that owns the source billing view, if this is a derived billing view.

        • billingViewType (string) --

          The type of billing view.

        • healthStatus (dict) --

          The current health status of the billing view.

          • statusCode (string) --

            The current health status code of the billing view.

          • statusReasons (list) --

            A list of reasons explaining the current health status, if applicable.

            • (string) --

    • nextToken (string) --

      The pagination token to use on subsequent calls to list billing views.

UpdateBillingView (updated) Link ¶
Changes (request)
{'dataFilterExpression': {'timeRange': {'beginDateInclusive': 'timestamp',
                                        'endDateInclusive': 'timestamp'}}}

An API to update the attributes of the billing view.

See also: AWS API Documentation

Request Syntax

client.update_billing_view(
    arn='string',
    name='string',
    description='string',
    dataFilterExpression={
        'dimensions': {
            'key': 'LINKED_ACCOUNT',
            'values': [
                'string',
            ]
        },
        'tags': {
            'key': 'string',
            'values': [
                'string',
            ]
        },
        'timeRange': {
            'beginDateInclusive': datetime(2015, 1, 1),
            'endDateInclusive': datetime(2015, 1, 1)
        }
    }
)
type arn:

string

param arn:

[REQUIRED]

The Amazon Resource Name (ARN) that can be used to uniquely identify the billing view.

type name:

string

param name:

The name of the billing view.

type description:

string

param description:

The description of the billing view.

type dataFilterExpression:

dict

param dataFilterExpression:

See Expression. Billing view only supports LINKED_ACCOUNT and Tags.

  • dimensions (dict) --

    The specific Dimension to use for Expression.

    • key (string) -- [REQUIRED]

      The names of the metadata types that you can use to filter and group your results.

    • values (list) -- [REQUIRED]

      The metadata values that you can use to filter and group your results.

      • (string) --

  • tags (dict) --

    The specific Tag to use for Expression.

    • key (string) -- [REQUIRED]

      The key for the tag.

    • values (list) -- [REQUIRED]

      The specific value of the tag.

      • (string) --

  • timeRange (dict) --

    Specifies a time range filter for the billing view data.

    • beginDateInclusive (datetime) --

      The inclusive start date of the time range.

    • endDateInclusive (datetime) --

      The inclusive end date of the time range.

rtype:

dict

returns:

Response Syntax

{
    'arn': 'string',
    'updatedAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • arn (string) --

      The Amazon Resource Name (ARN) that can be used to uniquely identify the billing view.

    • updatedAt (datetime) --

      The time when the billing view was last updated.