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
DescriptionResource Type definition for AWS::CE::CostCategory. Cost 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.
Idawscc.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
tagsarrayTags to assign to the cost category.
regionstringAWS region.

For more information, see AWS::CE::CostCategory.

Methods

NameResourceAccessible byRequired Params
create_resourcecost_categoriesINSERTName, RuleVersion, Rules, region
delete_resourcecost_categoriesDELETEIdentifier, region
update_resourcecost_categoriesUPDATEIdentifier, PatchDocument, region
list_resourcescost_categories_list_onlySELECTregion
get_resourcecost_categoriesSELECTIdentifier, region

SELECT examples

Gets all properties from an individual cost_category.

SELECT
region,
arn,
effective_start,
name,
rule_version,
rules,
split_charge_rules,
default_value,
tags
FROM awscc.ce.cost_categories
WHERE
region = '{{ region }}' AND
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 awscc.ce.cost_categories (
Name,
RuleVersion,
Rules,
region
)
SELECT
'{{ name }}',
'{{ rule_version }}',
'{{ rules }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

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

/*+ update */
UPDATE awscc.ce.cost_categories
SET PatchDocument = string('{{ {
"RuleVersion": rule_version,
"Rules": rules,
"SplitChargeRules": split_charge_rules,
"DefaultValue": default_value,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.ce.cost_categories
WHERE
Identifier = '{{ arn }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

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

ce:CreateCostCategoryDefinition,
ce:TagResource