2021/03/23 - AWS Cost Explorer Service - 4 updated api methods
Changes You can now create cost categories with inherited value rules and specify default values for any uncategorized costs.
{'DefaultValue': 'string', 'Rules': {'InheritedValue': {'DimensionKey': 'string', 'DimensionName': 'LINKED_ACCOUNT_NAME | TAG'}, 'Type': 'REGULAR | INHERITED_VALUE'}}
Creates a new Cost Category with the requested name and rules.
See also: AWS API Documentation
Request Syntax
client.create_cost_category_definition( Name='string', RuleVersion='CostCategoryExpression.v1', Rules=[ { 'Value': 'string', 'Rule': { 'Or': [ {'... recursive ...'}, ], 'And': [ {'... recursive ...'}, ], 'Not': {'... recursive ...'}, 'Dimensions': { 'Key': 'AZ'|'INSTANCE_TYPE'|'LINKED_ACCOUNT'|'LINKED_ACCOUNT_NAME'|'OPERATION'|'PURCHASE_TYPE'|'REGION'|'SERVICE'|'SERVICE_CODE'|'USAGE_TYPE'|'USAGE_TYPE_GROUP'|'RECORD_TYPE'|'OPERATING_SYSTEM'|'TENANCY'|'SCOPE'|'PLATFORM'|'SUBSCRIPTION_ID'|'LEGAL_ENTITY_NAME'|'DEPLOYMENT_OPTION'|'DATABASE_ENGINE'|'CACHE_ENGINE'|'INSTANCE_TYPE_FAMILY'|'BILLING_ENTITY'|'RESERVATION_ID'|'RESOURCE_ID'|'RIGHTSIZING_TYPE'|'SAVINGS_PLANS_TYPE'|'SAVINGS_PLAN_ARN'|'PAYMENT_OPTION'|'AGREEMENT_END_DATE_TIME_AFTER'|'AGREEMENT_END_DATE_TIME_BEFORE', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE', ] }, 'Tags': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE', ] }, 'CostCategories': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE', ] } }, 'InheritedValue': { 'DimensionName': 'LINKED_ACCOUNT_NAME'|'TAG', 'DimensionKey': 'string' }, 'Type': 'REGULAR'|'INHERITED_VALUE' }, ], DefaultValue='string' )
string
[REQUIRED]
The unique name of the Cost Category.
string
[REQUIRED]
The rule schema version in this particular Cost Category.
list
[REQUIRED]
The Cost Category rules used to categorize costs. For more information, see CostCategoryRule .
(dict) --
Rules are processed in order. If there are multiple rules that match the line item, then the first rule to match is used to determine that Cost Category value.
Value (string) --
The default value for the cost category.
Rule (dict) --
An Expression object used to categorize costs. This supports dimensions, tags, and nested expressions. Currently the only dimensions supported are LINKED_ACCOUNT , SERVICE_CODE , RECORD_TYPE , and LINKED_ACCOUNT_NAME .
Root level OR is not supported. We recommend that you create a separate rule instead.
RECORD_TYPE is a dimension used for Cost Explorer APIs, and is also supported for Cost Category expressions. This dimension uses different terms, depending on whether you're using the console or API/JSON editor. For a detailed comparison, see Term Comparisons in the AWS Billing and Cost Management User Guide .
Or (list) --
Return results that match either Dimension object.
(dict) --
Use Expression to filter by cost or by usage. There are two patterns:
Simple dimension values - You can set the dimension name and values for the filters that you plan to use. For example, you can filter for REGION==us-east-1 OR REGION==us-west-1 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example looks like: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", “us-west-1” ] } } The list of dimension values are OR'd together to retrieve cost or usage data. You can create Expression and DimensionValues objects using either with* methods or set* methods in multiple lines.
Compound dimension values with logical operations - You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. This allows you to filter on more advanced options. For example, you can filter on ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer) . The Expression for that looks like this: { "And": [ {"Or": [ {"Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] }}, {"Tags": { "Key": "TagName", "Values": ["Value1"] } } ]}, {"Not": {"Dimensions": { "Key": "USAGE_TYPE", "Values": ["DataTransfer"] }}} ] }
Note
Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error.
{ "And": [ ... ], "DimensionValues": { "Dimension": "USAGE_TYPE", "Values": [ "DataTransfer" ] } }
Note
For the GetRightsizingRecommendation action, a combination of OR and NOT is not supported. OR is not supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE .
For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR are not supported. Dimensions are limited to LINKED_ACCOUNT .
And (list) --
Return results that match both Dimension objects.
(dict) --
Use Expression to filter by cost or by usage. There are two patterns:
Simple dimension values - You can set the dimension name and values for the filters that you plan to use. For example, you can filter for REGION==us-east-1 OR REGION==us-west-1 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example looks like: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", “us-west-1” ] } } The list of dimension values are OR'd together to retrieve cost or usage data. You can create Expression and DimensionValues objects using either with* methods or set* methods in multiple lines.
Compound dimension values with logical operations - You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. This allows you to filter on more advanced options. For example, you can filter on ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer) . The Expression for that looks like this: { "And": [ {"Or": [ {"Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] }}, {"Tags": { "Key": "TagName", "Values": ["Value1"] } } ]}, {"Not": {"Dimensions": { "Key": "USAGE_TYPE", "Values": ["DataTransfer"] }}} ] }
Note
Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error.
{ "And": [ ... ], "DimensionValues": { "Dimension": "USAGE_TYPE", "Values": [ "DataTransfer" ] } }
Note
For the GetRightsizingRecommendation action, a combination of OR and NOT is not supported. OR is not supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE .
For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR are not supported. Dimensions are limited to LINKED_ACCOUNT .
Not (dict) --
Return results that don't match a Dimension object.
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. For example, AZ returns a list of Availability Zones.
Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
(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) --
MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
(string) --
CostCategories (dict) --
The filter based on CostCategory values.
Key (string) --
The unique name of the Cost Category.
Values (list) --
The specific value of the Cost Category.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
(string) --
InheritedValue (dict) --
The value the line item will be categorized as, if the line item contains the matched dimension.
DimensionName (string) --
The name of dimension for which to group costs.
If you specify LINKED_ACCOUNT_NAME , the cost category value will be based on account name. If you specify TAG , the cost category value will be based on the value of the specified tag key.
DimensionKey (string) --
The key to extract cost category values.
Type (string) --
You can define the CostCategoryRule rule type as either REGULAR or INHERITED_VALUE . The INHERITED_VALUE rule type adds the flexibility of defining a rule that dynamically inherits the cost category value from the dimension value defined by CostCategoryInheritedValueDimension . For example, if you wanted to dynamically group costs based on the value of a specific tag key, you would first choose an inherited value rule type, then choose the tag dimension and specify the tag key to use.
string
The default value for the cost category.
dict
Response Syntax
{ 'CostCategoryArn': 'string', 'EffectiveStart': 'string' }
Response Structure
(dict) --
CostCategoryArn (string) --
The unique identifier for your newly created Cost Category.
EffectiveStart (string) --
The Cost Category's effective start date.
{'CostCategory': {'DefaultValue': 'string', 'Rules': {'InheritedValue': {'DimensionKey': 'string', 'DimensionName': 'LINKED_ACCOUNT_NAME ' '| TAG'}, 'Type': 'REGULAR | INHERITED_VALUE'}}}
Returns the name, ARN, rules, definition, and effective dates of a Cost Category that's defined in the account.
You have the option to use EffectiveOn to return a Cost Category that is active on a specific date. If there is no EffectiveOn specified, you’ll see a Cost Category that is effective on the current date. If Cost Category is still effective, EffectiveEnd is omitted in the response.
See also: AWS API Documentation
Request Syntax
client.describe_cost_category_definition( CostCategoryArn='string', EffectiveOn='string' )
string
[REQUIRED]
The unique identifier for your Cost Category.
string
The date when the Cost Category was effective.
dict
Response Syntax
{ 'CostCategory': { 'CostCategoryArn': 'string', 'EffectiveStart': 'string', 'EffectiveEnd': 'string', 'Name': 'string', 'RuleVersion': 'CostCategoryExpression.v1', 'Rules': [ { 'Value': 'string', 'Rule': { 'Or': [ {'... recursive ...'}, ], 'And': [ {'... recursive ...'}, ], 'Not': {'... recursive ...'}, 'Dimensions': { 'Key': 'AZ'|'INSTANCE_TYPE'|'LINKED_ACCOUNT'|'LINKED_ACCOUNT_NAME'|'OPERATION'|'PURCHASE_TYPE'|'REGION'|'SERVICE'|'SERVICE_CODE'|'USAGE_TYPE'|'USAGE_TYPE_GROUP'|'RECORD_TYPE'|'OPERATING_SYSTEM'|'TENANCY'|'SCOPE'|'PLATFORM'|'SUBSCRIPTION_ID'|'LEGAL_ENTITY_NAME'|'DEPLOYMENT_OPTION'|'DATABASE_ENGINE'|'CACHE_ENGINE'|'INSTANCE_TYPE_FAMILY'|'BILLING_ENTITY'|'RESERVATION_ID'|'RESOURCE_ID'|'RIGHTSIZING_TYPE'|'SAVINGS_PLANS_TYPE'|'SAVINGS_PLAN_ARN'|'PAYMENT_OPTION'|'AGREEMENT_END_DATE_TIME_AFTER'|'AGREEMENT_END_DATE_TIME_BEFORE', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE', ] }, 'Tags': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE', ] }, 'CostCategories': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE', ] } }, 'InheritedValue': { 'DimensionName': 'LINKED_ACCOUNT_NAME'|'TAG', 'DimensionKey': 'string' }, 'Type': 'REGULAR'|'INHERITED_VALUE' }, ], 'ProcessingStatus': [ { 'Component': 'COST_EXPLORER', 'Status': 'PROCESSING'|'APPLIED' }, ], 'DefaultValue': 'string' } }
Response Structure
(dict) --
CostCategory (dict) --
The structure of Cost Categories. This includes detailed metadata and the set of rules for the CostCategory object.
CostCategoryArn (string) --
The unique identifier for your Cost Category.
EffectiveStart (string) --
The Cost Category's effective start date.
EffectiveEnd (string) --
The Cost Category's effective end date.
Name (string) --
The unique name of the Cost Category.
RuleVersion (string) --
The rule schema version in this particular Cost Category.
Rules (list) --
Rules are processed in order. If there are multiple rules that match the line item, then the first rule to match is used to determine that Cost Category value.
(dict) --
Rules are processed in order. If there are multiple rules that match the line item, then the first rule to match is used to determine that Cost Category value.
Value (string) --
The default value for the cost category.
Rule (dict) --
An Expression object used to categorize costs. This supports dimensions, tags, and nested expressions. Currently the only dimensions supported are LINKED_ACCOUNT , SERVICE_CODE , RECORD_TYPE , and LINKED_ACCOUNT_NAME .
Root level OR is not supported. We recommend that you create a separate rule instead.
RECORD_TYPE is a dimension used for Cost Explorer APIs, and is also supported for Cost Category expressions. This dimension uses different terms, depending on whether you're using the console or API/JSON editor. For a detailed comparison, see Term Comparisons in the AWS Billing and Cost Management User Guide .
Or (list) --
Return results that match either Dimension object.
(dict) --
Use Expression to filter by cost or by usage. There are two patterns:
Simple dimension values - You can set the dimension name and values for the filters that you plan to use. For example, you can filter for REGION==us-east-1 OR REGION==us-west-1 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example looks like: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", “us-west-1” ] } } The list of dimension values are OR'd together to retrieve cost or usage data. You can create Expression and DimensionValues objects using either with* methods or set* methods in multiple lines.
Compound dimension values with logical operations - You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. This allows you to filter on more advanced options. For example, you can filter on ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer) . The Expression for that looks like this: { "And": [ {"Or": [ {"Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] }}, {"Tags": { "Key": "TagName", "Values": ["Value1"] } } ]}, {"Not": {"Dimensions": { "Key": "USAGE_TYPE", "Values": ["DataTransfer"] }}} ] }
Note
Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error.
{ "And": [ ... ], "DimensionValues": { "Dimension": "USAGE_TYPE", "Values": [ "DataTransfer" ] } }
Note
For the GetRightsizingRecommendation action, a combination of OR and NOT is not supported. OR is not supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE .
For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR are not supported. Dimensions are limited to LINKED_ACCOUNT .
And (list) --
Return results that match both Dimension objects.
(dict) --
Use Expression to filter by cost or by usage. There are two patterns:
Simple dimension values - You can set the dimension name and values for the filters that you plan to use. For example, you can filter for REGION==us-east-1 OR REGION==us-west-1 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example looks like: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", “us-west-1” ] } } The list of dimension values are OR'd together to retrieve cost or usage data. You can create Expression and DimensionValues objects using either with* methods or set* methods in multiple lines.
Compound dimension values with logical operations - You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. This allows you to filter on more advanced options. For example, you can filter on ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer) . The Expression for that looks like this: { "And": [ {"Or": [ {"Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] }}, {"Tags": { "Key": "TagName", "Values": ["Value1"] } } ]}, {"Not": {"Dimensions": { "Key": "USAGE_TYPE", "Values": ["DataTransfer"] }}} ] }
Note
Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error.
{ "And": [ ... ], "DimensionValues": { "Dimension": "USAGE_TYPE", "Values": [ "DataTransfer" ] } }
Note
For the GetRightsizingRecommendation action, a combination of OR and NOT is not supported. OR is not supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE .
For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR are not supported. Dimensions are limited to LINKED_ACCOUNT .
Not (dict) --
Return results that don't match a Dimension object.
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. For example, AZ returns a list of Availability Zones.
Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
(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) --
MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
(string) --
CostCategories (dict) --
The filter based on CostCategory values.
Key (string) --
The unique name of the Cost Category.
Values (list) --
The specific value of the Cost Category.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
(string) --
InheritedValue (dict) --
The value the line item will be categorized as, if the line item contains the matched dimension.
DimensionName (string) --
The name of dimension for which to group costs.
If you specify LINKED_ACCOUNT_NAME , the cost category value will be based on account name. If you specify TAG , the cost category value will be based on the value of the specified tag key.
DimensionKey (string) --
The key to extract cost category values.
Type (string) --
You can define the CostCategoryRule rule type as either REGULAR or INHERITED_VALUE . The INHERITED_VALUE rule type adds the flexibility of defining a rule that dynamically inherits the cost category value from the dimension value defined by CostCategoryInheritedValueDimension . For example, if you wanted to dynamically group costs based on the value of a specific tag key, you would first choose an inherited value rule type, then choose the tag dimension and specify the tag key to use.
ProcessingStatus (list) --
The list of processing statuses for Cost Management products for a specific cost category.
(dict) --
The list of processing statuses for Cost Management products for a specific cost category.
Component (string) --
The Cost Management product name of the applied status.
Status (string) --
The process status for a specific cost category.
DefaultValue (string) --
The default value for the cost category.
{'CostCategoryReferences': {'DefaultValue': 'string'}}
Returns the name, ARN, NumberOfRules and effective dates of all Cost Categories defined in the account. You have the option to use EffectiveOn to return a list of Cost Categories that were active on a specific date. If there is no EffectiveOn specified, you’ll see Cost Categories that are effective on the current date. If Cost Category is still effective, EffectiveEnd is omitted in the response. ListCostCategoryDefinitions supports pagination. The request can have a MaxResults range up to 100.
See also: AWS API Documentation
Request Syntax
client.list_cost_category_definitions( EffectiveOn='string', NextToken='string', MaxResults=123 )
string
The date when the Cost Category was effective.
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.
integer
The number of entries a paginated response contains.
dict
Response Syntax
{ 'CostCategoryReferences': [ { 'CostCategoryArn': 'string', 'Name': 'string', 'EffectiveStart': 'string', 'EffectiveEnd': 'string', 'NumberOfRules': 123, 'ProcessingStatus': [ { 'Component': 'COST_EXPLORER', 'Status': 'PROCESSING'|'APPLIED' }, ], 'Values': [ 'string', ], 'DefaultValue': 'string' }, ], 'NextToken': 'string' }
Response Structure
(dict) --
CostCategoryReferences (list) --
A reference to a Cost Category containing enough information to identify the Cost Category.
(dict) --
A reference to a Cost Category containing only enough information to identify the Cost Category.
You can use this information to retrieve the full Cost Category information using DescribeCostCategory .
CostCategoryArn (string) --
The unique identifier for your Cost Category.
Name (string) --
The unique name of the Cost Category.
EffectiveStart (string) --
The Cost Category's effective start date.
EffectiveEnd (string) --
The Cost Category's effective end date.
NumberOfRules (integer) --
The number of rules associated with a specific Cost Category.
ProcessingStatus (list) --
The list of processing statuses for Cost Management products for a specific cost category.
(dict) --
The list of processing statuses for Cost Management products for a specific cost category.
Component (string) --
The Cost Management product name of the applied status.
Status (string) --
The process status for a specific cost category.
Values (list) --
A list of unique cost category values in a specific cost category.
(string) --
The default value for the cost category.
DefaultValue (string) --
The default value for the cost category.
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.
{'DefaultValue': 'string', 'Rules': {'InheritedValue': {'DimensionKey': 'string', 'DimensionName': 'LINKED_ACCOUNT_NAME | TAG'}, 'Type': 'REGULAR | INHERITED_VALUE'}}
Updates an existing Cost Category. Changes made to the Cost Category rules will be used to categorize the current month’s expenses and future expenses. This won’t change categorization for the previous months.
See also: AWS API Documentation
Request Syntax
client.update_cost_category_definition( CostCategoryArn='string', RuleVersion='CostCategoryExpression.v1', Rules=[ { 'Value': 'string', 'Rule': { 'Or': [ {'... recursive ...'}, ], 'And': [ {'... recursive ...'}, ], 'Not': {'... recursive ...'}, 'Dimensions': { 'Key': 'AZ'|'INSTANCE_TYPE'|'LINKED_ACCOUNT'|'LINKED_ACCOUNT_NAME'|'OPERATION'|'PURCHASE_TYPE'|'REGION'|'SERVICE'|'SERVICE_CODE'|'USAGE_TYPE'|'USAGE_TYPE_GROUP'|'RECORD_TYPE'|'OPERATING_SYSTEM'|'TENANCY'|'SCOPE'|'PLATFORM'|'SUBSCRIPTION_ID'|'LEGAL_ENTITY_NAME'|'DEPLOYMENT_OPTION'|'DATABASE_ENGINE'|'CACHE_ENGINE'|'INSTANCE_TYPE_FAMILY'|'BILLING_ENTITY'|'RESERVATION_ID'|'RESOURCE_ID'|'RIGHTSIZING_TYPE'|'SAVINGS_PLANS_TYPE'|'SAVINGS_PLAN_ARN'|'PAYMENT_OPTION'|'AGREEMENT_END_DATE_TIME_AFTER'|'AGREEMENT_END_DATE_TIME_BEFORE', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE', ] }, 'Tags': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE', ] }, 'CostCategories': { 'Key': 'string', 'Values': [ 'string', ], 'MatchOptions': [ 'EQUALS'|'ABSENT'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS'|'CASE_SENSITIVE'|'CASE_INSENSITIVE', ] } }, 'InheritedValue': { 'DimensionName': 'LINKED_ACCOUNT_NAME'|'TAG', 'DimensionKey': 'string' }, 'Type': 'REGULAR'|'INHERITED_VALUE' }, ], DefaultValue='string' )
string
[REQUIRED]
The unique identifier for your Cost Category.
string
[REQUIRED]
The rule schema version in this particular Cost Category.
list
[REQUIRED]
The Expression object used to categorize costs. For more information, see CostCategoryRule .
(dict) --
Rules are processed in order. If there are multiple rules that match the line item, then the first rule to match is used to determine that Cost Category value.
Value (string) --
The default value for the cost category.
Rule (dict) --
An Expression object used to categorize costs. This supports dimensions, tags, and nested expressions. Currently the only dimensions supported are LINKED_ACCOUNT , SERVICE_CODE , RECORD_TYPE , and LINKED_ACCOUNT_NAME .
Root level OR is not supported. We recommend that you create a separate rule instead.
RECORD_TYPE is a dimension used for Cost Explorer APIs, and is also supported for Cost Category expressions. This dimension uses different terms, depending on whether you're using the console or API/JSON editor. For a detailed comparison, see Term Comparisons in the AWS Billing and Cost Management User Guide .
Or (list) --
Return results that match either Dimension object.
(dict) --
Use Expression to filter by cost or by usage. There are two patterns:
Simple dimension values - You can set the dimension name and values for the filters that you plan to use. For example, you can filter for REGION==us-east-1 OR REGION==us-west-1 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example looks like: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", “us-west-1” ] } } The list of dimension values are OR'd together to retrieve cost or usage data. You can create Expression and DimensionValues objects using either with* methods or set* methods in multiple lines.
Compound dimension values with logical operations - You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. This allows you to filter on more advanced options. For example, you can filter on ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer) . The Expression for that looks like this: { "And": [ {"Or": [ {"Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] }}, {"Tags": { "Key": "TagName", "Values": ["Value1"] } } ]}, {"Not": {"Dimensions": { "Key": "USAGE_TYPE", "Values": ["DataTransfer"] }}} ] }
Note
Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error.
{ "And": [ ... ], "DimensionValues": { "Dimension": "USAGE_TYPE", "Values": [ "DataTransfer" ] } }
Note
For the GetRightsizingRecommendation action, a combination of OR and NOT is not supported. OR is not supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE .
For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR are not supported. Dimensions are limited to LINKED_ACCOUNT .
And (list) --
Return results that match both Dimension objects.
(dict) --
Use Expression to filter by cost or by usage. There are two patterns:
Simple dimension values - You can set the dimension name and values for the filters that you plan to use. For example, you can filter for REGION==us-east-1 OR REGION==us-west-1 . For GetRightsizingRecommendation , the Region is a full name (for example, REGION==US East (N. Virginia) . The Expression example looks like: { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", “us-west-1” ] } } The list of dimension values are OR'd together to retrieve cost or usage data. You can create Expression and DimensionValues objects using either with* methods or set* methods in multiple lines.
Compound dimension values with logical operations - You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. This allows you to filter on more advanced options. For example, you can filter on ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer) . The Expression for that looks like this: { "And": [ {"Or": [ {"Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] }}, {"Tags": { "Key": "TagName", "Values": ["Value1"] } } ]}, {"Not": {"Dimensions": { "Key": "USAGE_TYPE", "Values": ["DataTransfer"] }}} ] }
Note
Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error.
{ "And": [ ... ], "DimensionValues": { "Dimension": "USAGE_TYPE", "Values": [ "DataTransfer" ] } }
Note
For the GetRightsizingRecommendation action, a combination of OR and NOT is not supported. OR is not supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to LINKED_ACCOUNT , REGION , or RIGHTSIZING_TYPE .
For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR are not supported. Dimensions are limited to LINKED_ACCOUNT .
Not (dict) --
Return results that don't match a Dimension object.
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. For example, AZ returns a list of Availability Zones.
Values (list) --
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
(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) --
MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE .
(string) --
CostCategories (dict) --
The filter based on CostCategory values.
Key (string) --
The unique name of the Cost Category.
Values (list) --
The specific value of the Cost Category.
(string) --
MatchOptions (list) --
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE .
(string) --
InheritedValue (dict) --
The value the line item will be categorized as, if the line item contains the matched dimension.
DimensionName (string) --
The name of dimension for which to group costs.
If you specify LINKED_ACCOUNT_NAME , the cost category value will be based on account name. If you specify TAG , the cost category value will be based on the value of the specified tag key.
DimensionKey (string) --
The key to extract cost category values.
Type (string) --
You can define the CostCategoryRule rule type as either REGULAR or INHERITED_VALUE . The INHERITED_VALUE rule type adds the flexibility of defining a rule that dynamically inherits the cost category value from the dimension value defined by CostCategoryInheritedValueDimension . For example, if you wanted to dynamically group costs based on the value of a specific tag key, you would first choose an inherited value rule type, then choose the tag dimension and specify the tag key to use.
string
The default value for the cost category.
dict
Response Syntax
{ 'CostCategoryArn': 'string', 'EffectiveStart': 'string' }
Response Structure
(dict) --
CostCategoryArn (string) --
The unique identifier for your Cost Category.
EffectiveStart (string) --
The Cost Category's effective start date.