DescribeBudgetSpendForPrincipal
Describes one principal's spend in each user-based budget in the account, for each
budget's current period. A user-based budget uses the PublicOnDemandCost or
EstimatedContractedCost metric.
Results are paginated. Use the NextToken parameter to retrieve additional
results.
Request Syntax
{
"AccountId": "string",
"MaxResults": number,
"NextToken": "string",
"Principal": {
"Id": "string",
"Type": "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 budgets.Type: String
Length Constraints: Fixed length of 12.
Pattern:
\d{12}Required: Yes
- 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
- Principal
-
The principal whose spend you want to describe.
Type: SpendPrincipal object
Required: Yes
Response Syntax
{
"NextToken": "string",
"SpendByBudget": [
{
"BudgetLimit": {
"Amount": "string",
"Unit": "string"
},
"BudgetLimitDimensions": [
{
"Key": "string",
"Type": "string"
}
],
"BudgetName": "string",
"Keys": [ "string" ],
"LastUpdatedTime": number,
"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.
- 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+/=_-]+$ - SpendByBudget
-
The principal's spend in each budget. Each item has the budget's own current period.
Type: Array of PerBudgetSpendItem objects
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
- 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
DescribeBudgetSpendForPrincipal operation for an AWS
Identity and Access Management (IAM) role. The response has one item for each budget
that the role's spend counts toward:
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.DescribeBudgetSpendForPrincipal
{
"AccountId": "111122223333",
"Principal": {
"Type": "IAM_PRINCIPAL",
"Id": "arn:aws:iam::111122223333:role/ExampleRole"
}
}
Sample Response
{
"SpendByBudget": [
{
"BudgetName": "Example Role Budget",
"BudgetLimit": {
"Amount": "500",
"Unit": "USD"
},
"TimePeriod": {
"Start": 1793491200,
"End": 1796083199
},
"Spend": {
"Amount": "212.40",
"Unit": "USD"
},
"LimitStatus": "WITHIN_LIMIT",
"LastUsageTime": 1795651200,
"BudgetLimitDimensions": [
{
"Type": "DIMENSION",
"Key": "IAM_PRINCIPAL"
}
],
"Keys": ["arn:aws:iam::111122223333:role/ExampleRole"],
"LastUpdatedTime": 1795654800
}
]
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: