cost_category_definitions
Creates, updates, deletes, gets or lists a cost_category_definitions resource.
Overview
| Name | cost_category_definitions |
| Type | Resource |
| Id | aws.ce.cost_category_definitions |
Fields
The following fields are returned by SELECT queries:
- describe_cost_category_definition
- list_cost_category_definitions
| Name | Datatype | Description |
|---|---|---|
cost_category_arn | string | The unique identifier for your cost category. (pattern: <code>arn:aws[-a-z0-9]:[a-z0-9]+:[-a-z0-9]:[0-9]{12}:[-a-zA-Z0-9/:_]+</code>) |
default_value | string | The default value for the cost category. (pattern: <code>^(?! )[\p{L}\p{N}\p{Z}-_]*(?<! )$</code>) |
effective_end | string | The effective end date of your cost category. (pattern: <code>^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(([+-]\d\d:\d\d)|Z)$</code>) |
effective_start | string | The effective start date of your cost category. (pattern: <code>^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(([+-]\d\d:\d\d)|Z)$</code>) |
name | string | The unique name of the cost category. (pattern: <code>^(?! )[\p{L}\p{N}\p{Z}-_]*(?<! )$</code>) |
processing_status | array | The list of processing statuses for Cost Management products for a specific cost category. |
rule_version | string | The rule schema version in this particular cost category. (CostCategoryExpression.v1) |
rules | array | The 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. |
split_charge_rules | array | The split charge rules that are used to allocate your charges between your cost category values. |
| Name | Datatype | Description |
|---|---|---|
cost_category_arn | string | The unique identifier for your cost category. (pattern: <code>arn:aws[-a-z0-9]:[a-z0-9]+:[-a-z0-9]:[0-9]{12}:[-a-zA-Z0-9/:_]+</code>) |
default_value | string | The default value for the cost category. (pattern: <code>^(?! )[\p{L}\p{N}\p{Z}-_]*(?<! )$</code>) |
effective_end | string | The period of time that you want the usage and costs for. (pattern: <code>^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(([+-]\d\d:\d\d)|Z)$</code>) |
effective_start | string | The period of time that you want the usage and costs for. (pattern: <code>^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(([+-]\d\d:\d\d)|Z)$</code>) |
name | string | The unique name of the cost category. (pattern: <code>^(?! )[\p{L}\p{N}\p{Z}-_]*(?<! )$</code>) |
number_of_rules | integer | The number of rules that are associated with a specific cost category. |
processing_status | array | The list of processing statuses for Cost Management products for a specific cost category. |
supported_resource_types | array | The resource types supported by a specific cost category. |
values | array | A list of unique cost category values in a specific cost category. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_cost_category_definition | select | region | Returns the name, Amazon Resource 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's active on a specific date. If there's no EffectiveOn specified, you see a Cost Category that's effective on the current date. If cost category is still effective, EffectiveEnd is omitted in the response. | |
list_cost_category_definitions | select | region | Returns the name, Amazon Resource Name (ARN), NumberOfRules and effective dates of all cost categories defined in the account. You have the option to use EffectiveOn and SupportedResourceTypes 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. | |
create_cost_category_definition | insert | region, RuleVersion, Rules | Creates a new cost category with the requested name and rules. | |
update_cost_category_definition | update | region, CostCategoryArn, RuleVersion, Rules | 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. | |
delete_cost_category_definition | delete | region | Deletes a cost category. Expenses from this month going forward will no longer be categorized with this cost category. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- describe_cost_category_definition
- list_cost_category_definitions
Returns the name, Amazon Resource 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's active on a specific date. If there's no EffectiveOn specified, you see a Cost Category that's effective on the current date. If cost category is still effective, EffectiveEnd is omitted in the response.
SELECT
cost_category_arn,
default_value,
effective_end,
effective_start,
name,
processing_status,
rule_version,
rules,
split_charge_rules
FROM aws.ce.cost_category_definitions
WHERE region = '{{ region }}' -- required
;
Returns the name, Amazon Resource Name (ARN), NumberOfRules and effective dates of all cost categories defined in the account. You have the option to use EffectiveOn and SupportedResourceTypes 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.
SELECT
cost_category_arn,
default_value,
effective_end,
effective_start,
name,
number_of_rules,
processing_status,
supported_resource_types,
values
FROM aws.ce.cost_category_definitions
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_cost_category_definition
- Manifest
Creates a new cost category with the requested name and rules.
INSERT INTO aws.ce.cost_category_definitions (
Name,
EffectiveStart,
RuleVersion,
Rules,
DefaultValue,
SplitChargeRules,
ResourceTags,
region
)
SELECT
'{{ Name }}',
'{{ EffectiveStart }}',
'{{ RuleVersion }}' /* required */,
'{{ Rules }}' /* required */,
'{{ DefaultValue }}',
'{{ SplitChargeRules }}',
'{{ ResourceTags }}',
'{{ region }}'
RETURNING
cost_category_arn,
effective_start
;
# Description fields are for documentation purposes
- name: cost_category_definitions
props:
- name: region
value: "{{ region }}"
description: Required parameter for the cost_category_definitions resource.
- name: Name
value: "{{ Name }}"
description: |
The unique name of the cost category.
- name: EffectiveStart
value: "{{ EffectiveStart }}"
description: |
The cost category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future.
- name: RuleVersion
value: "{{ RuleVersion }}"
description: |
The rule schema version in this particular cost category.
valid_values: ['CostCategoryExpression.v1']
- name: Rules
description: |
The cost category rules used to categorize costs. For more information, see CostCategoryRule.
value:
- Value: "{{ Value }}"
Rule:
Or:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
And:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Dimensions:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
And:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
And:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Dimensions:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Not:
Or:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
And:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Not:
Or:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
And:
- Or: "{{ Or }}"
And: "{{ And }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Not:
Or: "{{ Or }}"
And: "{{ And }}"
Not: "{{ Not }}"
Dimensions: "{{ Dimensions }}"
Tags: "{{ Tags }}"
CostCategories: "{{ CostCategories }}"
Dimensions:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values: "{{ Values }}"
MatchOptions: "{{ MatchOptions }}"
Dimensions:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Dimensions:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
Tags:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
CostCategories:
Key: "{{ Key }}"
Values:
- "{{ Values }}"
MatchOptions:
- "{{ MatchOptions }}"
InheritedValue:
DimensionName: "{{ DimensionName }}"
DimensionKey: "{{ DimensionKey }}"
Type: "{{ Type }}"
- name: DefaultValue
value: "{{ DefaultValue }}"
description: |
The default value for the cost category.
- name: SplitChargeRules
description: |
The split charge rules used to allocate your charges between your cost category values.
value:
- Source: "{{ Source }}"
Targets: "{{ Targets }}"
Method: "{{ Method }}"
Parameters: "{{ Parameters }}"
- name: ResourceTags
description: |
An optional list of tags to associate with the specified CostCategory . You can use resource tags to control access to your cost category using IAM policies. Each tag consists of a key and a value, and each key must be unique for the resource. The following restrictions apply to resource tags: Although the maximum number of array members is 200, you can assign a maximum of 50 user-tags to one resource. The remaining are reserved for Amazon Web Services use The maximum length of a key is 128 characters The maximum length of a value is 256 characters Keys and values can only contain alphanumeric characters, spaces, and any of the following: _.:/=+@- Keys and values are case sensitive Keys and values are trimmed for any leading or trailing whitespaces Don’t use aws: as a prefix for your keys. This prefix is reserved for Amazon Web Services use
value:
- Key: "{{ Key }}"
Value: "{{ Value }}"
UPDATE examples
- update_cost_category_definition
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.
UPDATE aws.ce.cost_category_definitions
SET
CostCategoryArn = '{{ CostCategoryArn }}',
EffectiveStart = '{{ EffectiveStart }}',
RuleVersion = '{{ RuleVersion }}',
Rules = '{{ Rules }}',
DefaultValue = '{{ DefaultValue }}',
SplitChargeRules = '{{ SplitChargeRules }}'
WHERE
region = '{{ region }}' --required
AND CostCategoryArn = '{{ CostCategoryArn }}' --required
AND RuleVersion = '{{ RuleVersion }}' --required
AND Rules = '{{ Rules }}' --required
RETURNING
cost_category_arn,
effective_start;
DELETE examples
- delete_cost_category_definition
Deletes a cost category. Expenses from this month going forward will no longer be categorized with this cost category.
DELETE FROM aws.ce.cost_category_definitions
WHERE region = '{{ region }}' --required
;