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 = '{{ region }}' AND
Identifier = '{{ arn }}';
Lists all cost_categories in a region.
SELECT
region,
arn
FROM awscc.ce.cost_categories_list_only
WHERE
region = '{{ region }}';
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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ 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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
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 }}'
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:
| Parameter | Description |
|---|---|
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:
- Create
- Read
- Update
- Delete
- List
ce:CreateCostCategoryDefinition,
ce:TagResource
ce:DescribeCostCategoryDefinition,
ce:ListTagsForResource
ce:UpdateCostCategoryDefinition,
ce:TagResource,
ce:UntagResource
ce:DeleteCostCategoryDefinition
ce:ListCostCategoryDefinitions