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 | 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 | aws.ce.cost_categories |
Fields
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 |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | Name, RuleVersion, Rules, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__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
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.ce.cost_categories (
Name,
RuleVersion,
Rules,
region
)
SELECT
'{{ Name }}',
'{{ RuleVersion }}',
'{{ Rules }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.ce.cost_categories (
Name,
RuleVersion,
Rules,
SplitChargeRules,
DefaultValue,
region
)
SELECT
'{{ Name }}',
'{{ RuleVersion }}',
'{{ Rules }}',
'{{ SplitChargeRules }}',
'{{ DefaultValue }}',
'{{ 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: RuleVersion
value: '{{ RuleVersion }}'
- name: Rules
value: '{{ Rules }}'
- name: SplitChargeRules
value: '{{ SplitChargeRules }}'
- name: DefaultValue
value: '{{ DefaultValue }}'
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