GetReservationUtilization
Retrieves the reservation utilization for your account. Management account in an
organization have access to member accounts. You can filter data by dimensions in a time
period. You can use GetDimensionValues
to determine the possible dimension
values. Currently, you can group only by SUBSCRIPTION_ID
.
Request Syntax
{
"Filter": {
"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
" ]
}
},
"Granularity": "string
",
"GroupBy": [
{
"Key": "string
",
"Type": "string
"
}
],
"MaxResults": number
,
"NextPageToken": "string
",
"SortBy": {
"Key": "string
",
"SortOrder": "string
"
},
"TimePeriod": {
"End": "string
",
"Start": "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.
- Filter
-
Filters utilization data by dimensions. You can filter by the following dimensions:
-
AZ
-
CACHE_ENGINE
-
DEPLOYMENT_OPTION
-
INSTANCE_TYPE
-
LINKED_ACCOUNT
-
OPERATING_SYSTEM
-
PLATFORM
-
REGION
-
SERVICE
Note
If not specified, the
SERVICE
filter defaults to Amazon Elastic Compute Cloud - Compute. Supported values forSERVICE
are Amazon Elastic Compute Cloud - Compute, Amazon Relational Database Service, Amazon ElastiCache, Amazon Redshift, and Amazon Elasticsearch Service. The value for theSERVICE
filter should not exceed "1". -
SCOPE
-
TENANCY
GetReservationUtilization
uses the same Expression object as the other operations, but onlyAND
is supported among each dimension, and nesting is supported up to only one level deep. If there are multiple values for a dimension, they are OR'd together.Type: Expression object
Required: No
-
- Granularity
-
If
GroupBy
is set,Granularity
can't be set. IfGranularity
isn't set, the response object doesn't includeGranularity
, eitherMONTHLY
orDAILY
. If bothGroupBy
andGranularity
aren't set,GetReservationUtilization
defaults toDAILY
.The
GetReservationUtilization
operation supports onlyDAILY
andMONTHLY
granularities.Type: String
Valid Values:
DAILY | MONTHLY | HOURLY
Required: No
- GroupBy
-
Groups only by
SUBSCRIPTION_ID
. Metadata is included.Type: Array of GroupDefinition objects
Required: No
- MaxResults
-
The maximum number of objects that you returned for this request. If more objects are available, in the response, AWS provides a NextPageToken value that you can use in a subsequent call to get the next batch of objects.
Type: Integer
Valid Range: Minimum value of 1.
Required: No
- NextPageToken
-
The token to retrieve the next set of results. AWS provides the token when the response from a previous call has more results than the maximum page size.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 8192.
Pattern:
[\S\s]*
Required: No
- SortBy
-
The value that you want to sort the data by.
The following values are supported for
Key
:-
UtilizationPercentage
-
UtilizationPercentageInUnits
-
PurchasedHours
-
PurchasedUnits
-
TotalActualHours
-
TotalActualUnits
-
UnusedHours
-
UnusedUnits
-
OnDemandCostOfRIHoursUsed
-
NetRISavings
-
TotalPotentialRISavings
-
AmortizedUpfrontFee
-
AmortizedRecurringFee
-
TotalAmortizedFee
-
RICostForUnusedHours
-
RealizedSavings
-
UnrealizedSavings
The supported values for
SortOrder
areASCENDING
andDESCENDING
.Type: SortDefinition object
Required: No
-
- TimePeriod
-
Sets the start and end dates for retrieving Reserved Instance (RI) utilization. The start date is inclusive, but the end date is exclusive. For example, if
start
is2017-01-01
andend
is2017-05-01
, then the cost and usage data is retrieved from2017-01-01
up to and including2017-04-30
but not including2017-05-01
.Type: DateInterval object
Required: Yes
Response Syntax
{
"NextPageToken": "string",
"Total": {
"AmortizedRecurringFee": "string",
"AmortizedUpfrontFee": "string",
"NetRISavings": "string",
"OnDemandCostOfRIHoursUsed": "string",
"PurchasedHours": "string",
"PurchasedUnits": "string",
"RealizedSavings": "string",
"RICostForUnusedHours": "string",
"TotalActualHours": "string",
"TotalActualUnits": "string",
"TotalAmortizedFee": "string",
"TotalPotentialRISavings": "string",
"UnrealizedSavings": "string",
"UnusedHours": "string",
"UnusedUnits": "string",
"UtilizationPercentage": "string",
"UtilizationPercentageInUnits": "string"
},
"UtilizationsByTime": [
{
"Groups": [
{
"Attributes": {
"string" : "string"
},
"Key": "string",
"Utilization": {
"AmortizedRecurringFee": "string",
"AmortizedUpfrontFee": "string",
"NetRISavings": "string",
"OnDemandCostOfRIHoursUsed": "string",
"PurchasedHours": "string",
"PurchasedUnits": "string",
"RealizedSavings": "string",
"RICostForUnusedHours": "string",
"TotalActualHours": "string",
"TotalActualUnits": "string",
"TotalAmortizedFee": "string",
"TotalPotentialRISavings": "string",
"UnrealizedSavings": "string",
"UnusedHours": "string",
"UnusedUnits": "string",
"UtilizationPercentage": "string",
"UtilizationPercentageInUnits": "string"
},
"Value": "string"
}
],
"TimePeriod": {
"End": "string",
"Start": "string"
},
"Total": {
"AmortizedRecurringFee": "string",
"AmortizedUpfrontFee": "string",
"NetRISavings": "string",
"OnDemandCostOfRIHoursUsed": "string",
"PurchasedHours": "string",
"PurchasedUnits": "string",
"RealizedSavings": "string",
"RICostForUnusedHours": "string",
"TotalActualHours": "string",
"TotalActualUnits": "string",
"TotalAmortizedFee": "string",
"TotalPotentialRISavings": "string",
"UnrealizedSavings": "string",
"UnusedHours": "string",
"UnusedUnits": "string",
"UtilizationPercentage": "string",
"UtilizationPercentageInUnits": "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.
- NextPageToken
-
The token for the next set of retrievable results. AWS provides the token when the response from a previous call has more results than the maximum page size.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 8192.
Pattern:
[\S\s]*
- Total
-
The total amount of time that you used your Reserved Instances (RIs).
Type: ReservationAggregates object
- UtilizationsByTime
-
The amount of time that you used your Reserved Instances (RIs).
Type: Array of UtilizationByTime objects
Errors
For information about the errors that are common to all actions, see Common Errors.
- DataUnavailableException
-
The requested data is unavailable.
HTTP Status Code: 400
- InvalidNextTokenException
-
The pagination token is invalid. Try again without a pagination token.
HTTP Status Code: 400
- LimitExceededException
-
You made too many calls in a short period of time. Try again later.
HTTP Status Code: 400
Examples
Example
The following is a sample request and response of the
GetReservationUtilization
operation that enables you to retrieve your RI
utilization for all t2.nano
instance types from 2017-01-01 to
2017-05-01.
Sample Request
POST / HTTP/1.1
Host: ce.us-east-1.amazonaws.com
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: AWSInsightsIndexService.GetReservationUtilization
{
"TimePeriod": {
"Start":"2017-07-01",
"End": "2017-10-01"
},
"Filter": {
"Dimensions": {
"Key": "INSTANCE_TYPE",
"Values": [
"t2.nano"
]
}
},
"GroupBy":[
{
"Type":"Dimension",
"Key":"SUBSCRIPTION_ID"
}
]
}
Sample Response
HTTP/1.1 200 OK
x-amzn-RequestId: <RequestId>
Content-Type: application/x-amz-json-1.1
Content-Length: <PayloadSizeBytes>
Date: <Date>
{
"UtilizationsByTime": [{
"Groups": [{
"Attributes": {
"AccountId": "0123456789",
"AccountName": null,
"AvailabilityZone": "",
"CancellationDateTime": "2019-09-28T15:22:31.000Z",
"EndDateTime": "2019-09-28T15:22:31.000Z",
"InstanceType": "t2.nano",
"LeaseId": null,
"NumberOfInstances": "1",
"OfferingType": "convertible",
"Platform": "Linux/UNIX",
"Region": "us-east-1",
"Scope": "Region",
"StartDateTime": "2016-09-28T15:22:32.000Z",
"SubscriptionId": "359809062",
"SubscriptionStatus": "Active",
"SubscriptionType": "All Upfront",
"Tenancy": "Shared"
},
"Key": "SUBSCRIPTION_ID",
"Utilization": {
"PurchasedHours": 2208,
"TotalActualHours": 2208,
"UnusedHours": 0,
"UtilizationPercentage": 100
},
"Value": "359809062"
},
{
"Attributes": {
"": "0123456789",
"AccountName": null,
"AvailabilityZone": "us-east-1d",
"CancellationDateTime": "2017-09-28T15:22:31.000Z",
"EndDateTime": "2017-09-28T15:22:31.000Z",
"InstanceType": "t2.nano",
"LeaseId": null,
"NumberOfInstances": "1",
"OfferingType": "Standard",
"Platform": "Linux/UNIX",
"Region": "us-east-1",
"Scope": "Availability Zone",
"StartDateTime": "2016-09-28T15:22:32.000Z",
"SubscriptionId": "359809070",
"SubscriptionStatus": "Active",
"SubscriptionType": "All Upfront",
"Tenancy": "Shared"
},
"Key": "SUBSCRIPTION_ID",
"Utilization": {
"PurchasedHours": 2151,
"TotalActualHours": 2151,
"UnusedHours": 0,
"UtilizationPercentage": 100
},
"Value": "359809070"
},
{
"Attributes": {
"AccountId": "0123456789",
"AccountName": null,
"AvailabilityZone": "us-west-2a",
"CancellationDateTime": "2017-09-20T04:06:02.000Z",
"EndDateTime": "2017-09-20T04:06:02.000Z",
"InstanceType": "t2.nano",
"LeaseId": null,
"NumberOfInstances": "1",
"OfferingType": "Standard",
"Platform": "Linux/UNIX",
"Region": "us-west-2",
"Scope": "Availability Zone",
"StartDateTime": "2016-09-20T04:06:03.000Z",
"SubscriptionId": "353571154",
"SubscriptionStatus": "Active",
"SubscriptionType": "Partial Upfront",
"Tenancy": "Shared"
},
"Key": "SUBSCRIPTION_ID",
"Utilization": {
"PurchasedHours": 1948,
"TotalActualHours": 0,
"UnusedHours": 1948,
"UtilizationPercentage": 0
},
"Value": "353571154"
}
],
"TimePeriod": {
"End": "2017-10-01",
"Start": "2017-07-01"
},
"Total": {
"PurchasedHours": 6307,
"TotalActualHours": 4359,
"UnusedHours": 1948,
"UtilizationPercentage": 69.11368320913270968764864436340574
}
}]
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: