CreateCostCategoryDefinition - AWS Billing and Cost Management

CreateCostCategoryDefinition

Creates a new Cost Category with the requested name and rules.

Request Syntax

{ "DefaultValue": "string", "EffectiveStart": "string", "Name": "string", "ResourceTags": [ { "Key": "string", "Value": "string" } ], "Rules": [ { "InheritedValue": { "DimensionKey": "string", "DimensionName": "string" }, "Rule": { "And": [ "Expression" ], "CostCategories": { "Key": "string", "MatchOptions": [ "string" ], "Values": [ "string" ] }, "Dimensions": { "Key": "string", "MatchOptions": [ "string" ], "Values": [ "string" ] }, "Not": "Expression", "Or": [ "Expression" ], "Tags": { "Key": "string", "MatchOptions": [ "string" ], "Values": [ "string" ] } }, "Type": "string", "Value": "string" } ], "RuleVersion": "string", "SplitChargeRules": [ { "Method": "string", "Parameters": [ { "Type": "string", "Values": [ "string" ] } ], "Source": "string", "Targets": [ "string" ] } ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

DefaultValue

The default value for the cost category.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 50.

Pattern: ^(?! )[\p{L}\p{N}\p{Z}-_]*(?<! )$

Required: No

EffectiveStart

The Cost Category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 25.

Pattern: ^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(([+-]\d\d:\d\d)|Z)$

Required: No

Name

The unique name of the Cost Category.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 50.

Pattern: ^(?! )[\p{L}\p{N}\p{Z}-_]*(?<! )$

Required: Yes

ResourceTags

An optional list of tags to associate with the specified CostCategory. You can use resource tags to control access to your cost category using IAM policies.

Each tag consists of a key and a value, and each key must be unique for the resource. The following restrictions apply to resource tags:

  • Although the maximum number of array members is 200, you can assign a maximum of 50 user-tags to one resource. The remaining are reserved for AWS use

  • The maximum length of a key is 128 characters

  • The maximum length of a value is 256 characters

  • Keys and values can only contain alphanumeric characters, spaces, and any of the following: _.:/=+@-

  • Keys and values are case sensitive

  • Keys and values are trimmed for any leading or trailing whitespaces

  • Don’t use aws: as a prefix for your keys. This prefix is reserved for AWS use

Type: Array of ResourceTag objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Required: No

Rules

The Cost Category rules used to categorize costs. For more information, see CostCategoryRule.

Type: Array of CostCategoryRule objects

Array Members: Minimum number of 1 item. Maximum number of 500 items.

Required: Yes

RuleVersion

The rule schema version in this particular Cost Category.

Type: String

Valid Values: CostCategoryExpression.v1

Required: Yes

SplitChargeRules

The split charge rules used to allocate your charges between your Cost Category values.

Type: Array of CostCategorySplitChargeRule objects

Array Members: Minimum number of 1 item. Maximum number of 10 items.

Required: No

Response Syntax

{ "CostCategoryArn": "string", "EffectiveStart": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

CostCategoryArn

The unique identifier for your newly created Cost Category.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

Pattern: arn:aws[-a-z0-9]*:[a-z0-9]+:[-a-z0-9]*:[0-9]{12}:[-a-zA-Z0-9/:_]+

EffectiveStart

The Cost Category's effective start date. It can only be a billing start date (first day of the month).

Type: String

Length Constraints: Minimum length of 20. Maximum length of 25.

Pattern: ^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(([+-]\d\d:\d\d)|Z)$

Errors

For information about the errors that are common to all actions, see Common Errors.

LimitExceededException

You made too many calls in a short period of time. Try again later.

HTTP Status Code: 400

ServiceQuotaExceededException

You've reached the limit on the number of resources you can create, or exceeded the size of an individual resource.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: