cost_categories
Creates, updates, deletes or gets a cost_category resource or lists cost_categories in a region
Overview
| Name | cost_categories |
| Type | Resource |
| Description | Resource 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. |
| Id | awscc.ce.cost_categories |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
arn | string | Cost category ARN |
effective_start | string | ISO 8601 date time with offset format |
name | string | |
rule_version | string | |
rules | string | JSON array format of Expression in Billing and Cost Management API |
split_charge_rules | string | Json array format of CostCategorySplitChargeRule in Billing and Cost Management API |
default_value | string | The default value for the cost category |
tags | array | Tags to assign to the cost category. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
arn | string | Cost category ARN |
region | string | AWS region. |
For more information, see AWS::CE::CostCategory.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | cost_categories | INSERT | Name, RuleVersion, Rules, region |
delete_resource | cost_categories | DELETE | Identifier, region |
update_resource | cost_categories | UPDATE | Identifier, PatchDocument, region |
list_resources | cost_categories_list_only | SELECT | region |
get_resource | cost_categories | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 = 'us-east-1' AND
Identifier = '{{ arn }}';
Lists all cost_categories in a region.
SELECT
region,
arn
FROM awscc.ce.cost_categories_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new cost_category resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.ce.cost_categories (
Name,
RuleVersion,
Rules,
region
)
SELECT
'{{ name }}',
'{{ rule_version }}',
'{{ rules }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.ce.cost_categories (
Name,
RuleVersion,
Rules,
SplitChargeRules,
DefaultValue,
Tags,
region
)
SELECT
'{{ name }}',
'{{ rule_version }}',
'{{ rules }}',
'{{ split_charge_rules }}',
'{{ default_value }}',
'{{ tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: cost_category
props:
- name: name
value: '{{ name }}'
- name: rule_version
value: '{{ rule_version }}'
- name: rules
value: '{{ rules }}'
- name: split_charge_rules
value: '{{ split_charge_rules }}'
- name: default_value
value: '{{ default_value }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
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 }}';
DELETE example
/*+ delete */
DELETE FROM awscc.ce.cost_categories
WHERE
Identifier = '{{ arn }}' AND
region = 'us-east-1';
Permissions
To operate on the cost_categories resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
ce:CreateCostCategoryDefinition,
ce:TagResource
ce:DescribeCostCategoryDefinition,
ce:ListTagsForResource
ce:UpdateCostCategoryDefinition,
ce:TagResource,
ce:UntagResource
ce:DeleteCostCategoryDefinition
ce:ListCostCategoryDefinitions