Skip to main content

cost_categories

Creates, updates, deletes or gets a cost_category resource or lists cost_categories in a region

Overview

Namecost_categories
TypeResource
DescriptionCost Category enables you to map your cost and usage into meaningful categories. You can use Cost Category to organize your costs using a rule-based engine.
Idaws.ce.cost_categories

Fields

NameDatatypeDescription
arnstringCost category ARN
effective_startstringISO 8601 date time with offset format
namestring
rule_versionstring
rulesstringJSON array format of Expression in Billing and Cost Management API
split_charge_rulesstringJson array format of CostCategorySplitChargeRule in Billing and Cost Management API
default_valuestringThe default value for the cost category
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTName, RuleVersion, Rules, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all cost_categories in a region.

SELECT
region,
arn,
effective_start,
name,
rule_version,
rules,
split_charge_rules,
default_value
FROM aws.ce.cost_categories
WHERE region = 'us-east-1';

Gets all properties from an individual cost_category.

SELECT
region,
arn,
effective_start,
name,
rule_version,
rules,
split_charge_rules,
default_value
FROM aws.ce.cost_categories
WHERE region = 'us-east-1' AND data__Identifier = '<Arn>';

INSERT example

Use the following StackQL query and manifest file to create a new cost_category resource, using stack-deploy.

/*+ create */
INSERT INTO aws.ce.cost_categories (
Name,
RuleVersion,
Rules,
region
)
SELECT
'{{ Name }}',
'{{ RuleVersion }}',
'{{ Rules }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.ce.cost_categories
WHERE data__Identifier = '<Arn>'
AND region = 'us-east-1';

Permissions

To operate on the cost_categories resource, the following permissions are required:

Create

ce:CreateCostCategoryDefinition

Read

ce:DescribeCostCategoryDefinition

Update

ce:UpdateCostCategoryDefinition

Delete

ce:DeleteCostCategoryDefinition

List

ce:ListCostCategoryDefinitions