DescribeBudgetSpend
Describes the spend of a budget for the budget's current period. Use this operation
with a budget that uses the PublicOnDemandCost or
EstimatedContractedCost metric.
By default, the response has one row for each budget limit. If the budget has
BudgetLimitDimensions, set GroupBy to the budget's
SpendAttributions key to get one row for each principal instead. Use
FilterExpression to return only some principals. Rows are sorted by
spend, from highest to lowest.
Results are paginated. Use the NextToken parameter to retrieve additional
results.
Request Syntax
{
"AccountId": "string",
"BudgetName": "string",
"FilterExpression": {
"And": [
"Expression"
],
"CostCategories": {
"Key": "string",
"MatchOptions": [ "string" ],
"Values": [ "string" ]
},
"Dimensions": {
"Key": "string",
"MatchOptions": [ "string" ],
"Values": [ "string" ]
},
"IdentityCenterAttributes": {
"Key": "string",
"MatchOptions": [ "string" ],
"Values": [ "string" ]
},
"Not": "Expression",
"Or": [
"Expression"
],
"ProductAttributes": {
"Key": "string",
"MatchOptions": [ "string" ],
"Values": [ "string" ]
},
"Tags": {
"Key": "string",
"MatchOptions": [ "string" ],
"Values": [ "string" ]
}
},
"GroupBy": [
{
"Key": "string",
"Type": "string"
}
],
"MaxResults": number,
"NextToken": "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.
- AccountId
-
The
accountIdthat is associated with the budget.Type: String
Length Constraints: Fixed length of 12.
Pattern:
\d{12}Required: Yes
- BudgetName
-
The name of the budget whose spend you want to describe.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 100.
Pattern:
^(?![^:\\]*/action/|(?i).*<script>.*</script>.*)[^:\\]+$Required: Yes
- FilterExpression
-
The principals to return spend for. Specify one
Dimensionsclause whose key is the budget'sSpendAttributionsvalue, with theEQUALSmatch option and 1 to 20 principal IDs. If you don't specifyFilterExpression, AWS Budgets returns spend for every principal that has spend in the budget.Type: Expression object
Required: No
- GroupBy
-
How to group the spend. You can specify no entry or one entry. To get one row for each principal, specify one
DIMENSIONentry whose key is the budget'sSpendAttributionsvalue. If you don't specifyGroupBy, the response uses the budget'sBudgetLimitDimensions.Type: Array of GroupDefinition objects
Array Members: Minimum number of 0 items. Maximum number of 2 items.
Required: No
- MaxResults
-
The maximum number of results to return in one page. Valid range is 1 to 1000. If you don't specify
MaxResults, the default is 100.Type: Integer
Valid Range: Minimum value of 1. Maximum value of 1000.
Required: No
- NextToken
-
The pagination token that you include in your request to indicate the next set of results that you want to retrieve.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 4096.
Pattern:
^[A-Za-z0-9+/=_-]+$Required: No
Response Syntax
{
"BudgetLimit": {
"Amount": "string",
"Unit": "string"
},
"BudgetLimitDimensions": [
{
"Key": "string",
"Type": "string"
}
],
"GroupDefinitions": [
{
"Key": "string",
"Type": "string"
}
],
"LastUpdatedTime": number,
"NextToken": "string",
"SpendByGroup": [
{
"Keys": [ "string" ],
"LastUsageTime": number,
"LimitStatus": "string",
"Spend": {
"Amount": "string",
"Unit": "string"
}
}
],
"TimePeriod": {
"End": number,
"Start": number
}
}
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.
- BudgetLimit
-
The budget limit of the budget.
Type: Spend object
- BudgetLimitDimensions
-
The dimension that the budget limit applies to. With this value and
BudgetLimit, you can tell whether a row is a principal's own limit or a share of a limit for all principals.Type: Array of BudgetLimitDimension objects
Array Members: Minimum number of 0 items. Maximum number of 1 item.
- GroupDefinitions
-
The grouping that the response uses. The
Keysof each row inSpendByGroupfollow this order.Type: Array of GroupDefinition objects
Array Members: Minimum number of 0 items. Maximum number of 2 items.
- LastUpdatedTime
-
The time when AWS Budgets last updated the spend for the current period.
Type: Timestamp
- NextToken
-
The pagination token in the service response that indicates the next set of results that you can retrieve.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 4096.
Pattern:
^[A-Za-z0-9+/=_-]+$ - SpendByGroup
-
The rows of spend for the current period.
Type: Array of SpendGroup objects
- TimePeriod
-
The current period of the budget.
Type: TimePeriod object
Errors
For information about the errors that are common to all actions, see Common Error Types.
- AccessDeniedException
-
You are not authorized to use this operation with the given parameters.
- Message
-
The error message the exception carries.
HTTP Status Code: 400
- ExpiredNextTokenException
-
The pagination token expired.
- Message
-
The error message the exception carries.
HTTP Status Code: 400
- InternalErrorException
-
An error on the server occurred during the processing of your request. Try again later.
- Message
-
The error message the exception carries.
HTTP Status Code: 400
- InvalidNextTokenException
-
The pagination token is invalid.
- Message
-
The error message the exception carries.
HTTP Status Code: 400
- InvalidParameterException
-
An error on the client occurred. Typically, the cause is an invalid input value.
- Message
-
The error message the exception carries.
HTTP Status Code: 400
- NotFoundException
-
We can’t locate the resource that you specified.
- Message
-
The error message the exception carries.
HTTP Status Code: 400
- ThrottlingException
-
The number of API requests has exceeded the maximum allowed API request throttling limit for the account.
- Message
-
The error message the exception carries.
HTTP Status Code: 400
Examples
Example
The following is a sample request and response of the
DescribeBudgetSpend operation for a budget that gives each
Identity Center user their own limit. The response has one row for each user:
Sample Request
POST / HTTP/1.1
Host: awsbudgets.<region>.<domain>
x-amz-Date: <Date>
Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=contenttype;date;host;user-agent;x-amz-date;x-amz-target;x-amzn-requestid,Signature=<Signature>
User-Agent: <UserAgentString>
Content-Type: application/x-amz-json-1.1
Content-Length: <PayloadSizeBytes>
Connection: Keep-Alive
X-Amz-Target: AWSBudgetServiceGateway.DescribeBudgetSpend
{
"AccountId": "111122223333",
"BudgetName": "Example User Budget",
"GroupBy": [
{
"Type": "DIMENSION",
"Key": "IDENTITY_CENTER_USER"
}
],
"MaxResults": 2
}
Sample Response
{
"BudgetLimit": {
"Amount": "100",
"Unit": "USD"
},
"BudgetLimitDimensions": [
{
"Type": "DIMENSION",
"Key": "IDENTITY_CENTER_USER"
}
],
"GroupDefinitions": [
{
"Type": "DIMENSION",
"Key": "IDENTITY_CENTER_USER"
}
],
"SpendByGroup": [
{
"Keys": ["a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"],
"Spend": {
"Amount": "104.25",
"Unit": "USD"
},
"LimitStatus": "LIMIT_REACHED",
"LastUsageTime": 1795651200
},
{
"Keys": ["a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"],
"Spend": {
"Amount": "42.10",
"Unit": "USD"
},
"LimitStatus": "WITHIN_LIMIT",
"LastUsageTime": 1795647600
}
],
"TimePeriod": {
"Start": 1793491200,
"End": 1796083199
},
"LastUpdatedTime": 1795654800,
"NextToken": "eyJvZmZzZXQiOjJ9"
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: