AWS Cost Explorer Service

2022/06/07 - AWS Cost Explorer Service - 2 new api methods

Changes  Added two new APIs to support cost allocation tags operations: ListCostAllocationTags, UpdateCostAllocationTagsStatus.

ListCostAllocationTags (new) Link ¶

Get a list of cost allocation tags. All inputs in the API are optional and serve as filters. By default, all cost allocation tags are returned.

See also: AWS API Documentation

Request Syntax

client.list_cost_allocation_tags(
    Status='Active'|'Inactive',
    TagKeys=[
        'string',
    ],
    Type='AWSGenerated'|'UserDefined',
    NextToken='string',
    MaxResults=123
)
type Status

string

param Status

The status of cost allocation tag keys that are returned for this request.

type TagKeys

list

param TagKeys

The list of cost allocation tag keys that are returned for this request.

  • (string) --

type Type

string

param Type

The type of CostAllocationTag object that are returned for this request. The AWSGenerated type tags are tags that Amazon Web Services defines and applies to support Amazon Web Services resources for cost allocation purposes. The UserDefined type tags are tags that you define, create, and apply to resources.

type NextToken

string

param NextToken

The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.

type MaxResults

integer

param MaxResults

The maximum number of objects that are returned for this request. By default, the request returns 100 results.

rtype

dict

returns

Response Syntax

{
    'CostAllocationTags': [
        {
            'TagKey': 'string',
            'Type': 'AWSGenerated'|'UserDefined',
            'Status': 'Active'|'Inactive'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • CostAllocationTags (list) --

      A list of cost allocation tags that includes the detailed metadata for each one.

      • (dict) --

        The cost allocation tag structure. This includes detailed metadata for the CostAllocationTag object.

        • TagKey (string) --

          The key for the cost allocation tag.

        • Type (string) --

          The type of cost allocation tag. You can use AWSGenerated or UserDefined type tags. AWSGenerated type tags are tags that Amazon Web Services defines and applies to support Amazon Web Services resources for cost allocation purposes. UserDefined type tags are tags that you define, create, and apply to resources.

        • Status (string) --

          The status of a cost allocation tag.

    • NextToken (string) --

      The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size.

UpdateCostAllocationTagsStatus (new) Link ¶

Updates status for cost allocation tags in bulk, with maximum batch size of 20. If the tag status that's updated is the same as the existing tag status, the request doesn't fail. Instead, it doesn't have any effect on the tag status (for example, activating the active tag).

See also: AWS API Documentation

Request Syntax

client.update_cost_allocation_tags_status(
    CostAllocationTagsStatus=[
        {
            'TagKey': 'string',
            'Status': 'Active'|'Inactive'
        },
    ]
)
type CostAllocationTagsStatus

list

param CostAllocationTagsStatus

[REQUIRED]

The list of CostAllocationTagStatusEntry objects that are used to update cost allocation tags status for this request.

  • (dict) --

    The cost allocation tag status. The status of a key can either be active or inactive.

    • TagKey (string) -- [REQUIRED]

      The key for the cost allocation tag.

    • Status (string) -- [REQUIRED]

      The status of a cost allocation tag.

rtype

dict

returns

Response Syntax

{
    'Errors': [
        {
            'TagKey': 'string',
            'Code': 'string',
            'Message': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • Errors (list) --

      A list of UpdateCostAllocationTagsStatusError objects with error details about each cost allocation tag that can't be updated. If there's no failure, an empty array returns.

      • (dict) --

        Gives a detailed description of the result of an action. It's on each cost allocation tag entry in the request.

        • TagKey (string) --

          The key for the cost allocation tag.

        • Code (string) --

          An error code representing why the action failed on this entry.

        • Message (string) --

          A message explaining why the action failed on this entry.