- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
GetReservationCoverageCommand
Retrieves the reservation coverage for your account, which you can use to see how much of your Amazon Elastic Compute Cloud, Amazon ElastiCache, Amazon Relational Database Service, or Amazon Redshift usage is covered by a reservation. An organization's management account can see the coverage of the associated member accounts. This supports dimensions, Cost Categories, and nested expressions. For any time period, you can filter data about reservation usage by the following dimensions:
-
AZ
-
CACHE_ENGINE
-
DATABASE_ENGINE
-
DEPLOYMENT_OPTION
-
INSTANCE_TYPE
-
LINKED_ACCOUNT
-
OPERATING_SYSTEM
-
PLATFORM
-
REGION
-
SERVICE
-
TAG
-
TENANCY
To determine valid values for a dimension, use the GetDimensionValues
operation.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { CostExplorerClient, GetReservationCoverageCommand } from "@aws-sdk/client-cost-explorer"; // ES Modules import
// const { CostExplorerClient, GetReservationCoverageCommand } = require("@aws-sdk/client-cost-explorer"); // CommonJS import
const client = new CostExplorerClient(config);
const input = { // GetReservationCoverageRequest
TimePeriod: { // DateInterval
Start: "STRING_VALUE", // required
End: "STRING_VALUE", // required
},
GroupBy: [ // GroupDefinitions
{ // GroupDefinition
Type: "DIMENSION" || "TAG" || "COST_CATEGORY",
Key: "STRING_VALUE",
},
],
Granularity: "DAILY" || "MONTHLY" || "HOURLY",
Filter: { // Expression
Or: [ // Expressions
{
Or: [
"<Expression>",
],
And: [
"<Expression>",
],
Not: "<Expression>",
Dimensions: { // DimensionValues
Key: "AZ" || "INSTANCE_TYPE" || "LINKED_ACCOUNT" || "LINKED_ACCOUNT_NAME" || "OPERATION" || "PURCHASE_TYPE" || "REGION" || "SERVICE" || "SERVICE_CODE" || "USAGE_TYPE" || "USAGE_TYPE_GROUP" || "RECORD_TYPE" || "OPERATING_SYSTEM" || "TENANCY" || "SCOPE" || "PLATFORM" || "SUBSCRIPTION_ID" || "LEGAL_ENTITY_NAME" || "DEPLOYMENT_OPTION" || "DATABASE_ENGINE" || "CACHE_ENGINE" || "INSTANCE_TYPE_FAMILY" || "BILLING_ENTITY" || "RESERVATION_ID" || "RESOURCE_ID" || "RIGHTSIZING_TYPE" || "SAVINGS_PLANS_TYPE" || "SAVINGS_PLAN_ARN" || "PAYMENT_OPTION" || "AGREEMENT_END_DATE_TIME_AFTER" || "AGREEMENT_END_DATE_TIME_BEFORE" || "INVOICING_ENTITY" || "ANOMALY_TOTAL_IMPACT_ABSOLUTE" || "ANOMALY_TOTAL_IMPACT_PERCENTAGE",
Values: [ // Values
"STRING_VALUE",
],
MatchOptions: [ // MatchOptions
"EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
],
},
Tags: { // TagValues
Key: "STRING_VALUE",
Values: [
"STRING_VALUE",
],
MatchOptions: [
"EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
],
},
CostCategories: { // CostCategoryValues
Key: "STRING_VALUE",
Values: [
"STRING_VALUE",
],
MatchOptions: [
"EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
],
},
},
],
And: [
"<Expression>",
],
Not: "<Expression>",
Dimensions: {
Key: "AZ" || "INSTANCE_TYPE" || "LINKED_ACCOUNT" || "LINKED_ACCOUNT_NAME" || "OPERATION" || "PURCHASE_TYPE" || "REGION" || "SERVICE" || "SERVICE_CODE" || "USAGE_TYPE" || "USAGE_TYPE_GROUP" || "RECORD_TYPE" || "OPERATING_SYSTEM" || "TENANCY" || "SCOPE" || "PLATFORM" || "SUBSCRIPTION_ID" || "LEGAL_ENTITY_NAME" || "DEPLOYMENT_OPTION" || "DATABASE_ENGINE" || "CACHE_ENGINE" || "INSTANCE_TYPE_FAMILY" || "BILLING_ENTITY" || "RESERVATION_ID" || "RESOURCE_ID" || "RIGHTSIZING_TYPE" || "SAVINGS_PLANS_TYPE" || "SAVINGS_PLAN_ARN" || "PAYMENT_OPTION" || "AGREEMENT_END_DATE_TIME_AFTER" || "AGREEMENT_END_DATE_TIME_BEFORE" || "INVOICING_ENTITY" || "ANOMALY_TOTAL_IMPACT_ABSOLUTE" || "ANOMALY_TOTAL_IMPACT_PERCENTAGE",
Values: [
"STRING_VALUE",
],
MatchOptions: [
"EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
],
},
Tags: {
Key: "STRING_VALUE",
Values: [
"STRING_VALUE",
],
MatchOptions: [
"EQUALS" || "ABSENT" || "STARTS_WITH" || "ENDS_WITH" || "CONTAINS" || "CASE_SENSITIVE" || "CASE_INSENSITIVE" || "GREATER_THAN_OR_EQUAL",
],
},
CostCategories: {
Key: "STRING_VALUE",
Values: "<Values>",
MatchOptions: "<MatchOptions>",
},
},
Metrics: [ // MetricNames
"STRING_VALUE",
],
NextPageToken: "STRING_VALUE",
SortBy: { // SortDefinition
Key: "STRING_VALUE", // required
SortOrder: "ASCENDING" || "DESCENDING",
},
MaxResults: Number("int"),
};
const command = new GetReservationCoverageCommand(input);
const response = await client.send(command);
// { // GetReservationCoverageResponse
// CoveragesByTime: [ // CoveragesByTime // required
// { // CoverageByTime
// TimePeriod: { // DateInterval
// Start: "STRING_VALUE", // required
// End: "STRING_VALUE", // required
// },
// Groups: [ // ReservationCoverageGroups
// { // ReservationCoverageGroup
// Attributes: { // Attributes
// "<keys>": "STRING_VALUE",
// },
// Coverage: { // Coverage
// CoverageHours: { // CoverageHours
// OnDemandHours: "STRING_VALUE",
// ReservedHours: "STRING_VALUE",
// TotalRunningHours: "STRING_VALUE",
// CoverageHoursPercentage: "STRING_VALUE",
// },
// CoverageNormalizedUnits: { // CoverageNormalizedUnits
// OnDemandNormalizedUnits: "STRING_VALUE",
// ReservedNormalizedUnits: "STRING_VALUE",
// TotalRunningNormalizedUnits: "STRING_VALUE",
// CoverageNormalizedUnitsPercentage: "STRING_VALUE",
// },
// CoverageCost: { // CoverageCost
// OnDemandCost: "STRING_VALUE",
// },
// },
// },
// ],
// Total: {
// CoverageHours: {
// OnDemandHours: "STRING_VALUE",
// ReservedHours: "STRING_VALUE",
// TotalRunningHours: "STRING_VALUE",
// CoverageHoursPercentage: "STRING_VALUE",
// },
// CoverageNormalizedUnits: {
// OnDemandNormalizedUnits: "STRING_VALUE",
// ReservedNormalizedUnits: "STRING_VALUE",
// TotalRunningNormalizedUnits: "STRING_VALUE",
// CoverageNormalizedUnitsPercentage: "STRING_VALUE",
// },
// CoverageCost: {
// OnDemandCost: "STRING_VALUE",
// },
// },
// },
// ],
// Total: "<Coverage>",
// NextPageToken: "STRING_VALUE",
// };
GetReservationCoverageCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
TimePeriod Required | DateInterval | undefined | The start and end dates of the period that you want to retrieve data about reservation coverage for. You can retrieve data for a maximum of 13 months: the last 12 months and the current month. The start date is inclusive, but the end date is exclusive. For example, if |
Filter | Expression | undefined | Filters utilization data by dimensions. You can filter by the following dimensions:
If you don't provide a Cost category is also supported. |
Granularity | Granularity | undefined | The granularity of the Amazon Web Services cost data for the reservation. Valid values are If The |
GroupBy | GroupDefinition[] | undefined | You can group the data by the following attributes:
|
MaxResults | number | undefined | The maximum number of objects that you returned for this request. If more objects are available, in the response, Amazon Web Services provides a NextPageToken value that you can use in a subsequent call to get the next batch of objects. |
Metrics | string[] | undefined | The measurement that you want your reservation coverage reported in. Valid values are |
NextPageToken | string | undefined | The token to retrieve the next set of results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size. |
SortBy | SortDefinition | undefined | The value by which you want to sort the data. The following values are supported for
Supported values for |
GetReservationCoverageCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
CoveragesByTime Required | CoverageByTime[] | undefined | The amount of time that your reservations covered. |
NextPageToken | string | undefined | The token for the next set of retrievable results. Amazon Web Services provides the token when the response from a previous call has more results than the maximum page size. |
Total | Coverage | undefined | The total amount of instance usage that a reservation covered. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
DataUnavailableException | client | The requested data is unavailable. |
InvalidNextTokenException | client | The pagination token is invalid. Try again without a pagination token. |
LimitExceededException | client | You made too many calls in a short period of time. Try again later. |
CostExplorerServiceException | Base exception class for all service exceptions from CostExplorer service. |