Skip to main content

cost_category_definitions

Creates, updates, deletes, gets or lists a cost_category_definitions resource.

Overview

Namecost_category_definitions
TypeResource
Idaws.ce.cost_category_definitions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
cost_category_arnstringThe 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_valuestringThe default value for the cost category. (pattern: <code>^(?! )[\p{L}\p{N}\p{Z}-_]*(?<! )$</code>)
effective_endstringThe 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_startstringThe 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>)
namestringThe unique name of the cost category. (pattern: <code>^(?! )[\p{L}\p{N}\p{Z}-_]*(?<! )$</code>)
processing_statusarrayThe list of processing statuses for Cost Management products for a specific cost category.
rule_versionstringThe rule schema version in this particular cost category. (CostCategoryExpression.v1)
rulesarrayThe 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_rulesarrayThe split charge rules that are used to allocate your charges between your cost category values.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_cost_category_definitionselectregionReturns 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_definitionsselectregionReturns 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_definitioninsertregion, RuleVersion, RulesCreates a new cost category with the requested name and rules.
update_cost_category_definitionupdateregion, CostCategoryArn, RuleVersion, RulesUpdates 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_definitiondeleteregionDeletes 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.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

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
;

INSERT examples

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
;

UPDATE examples

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

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
;