get_reservation_coverage
¶
get_reservation_coverage(
time_period: DateInterval,
*,
config_overrides: Optional[CostExplorerClientConfig] = None,
group_by: Optional[GroupDefinitions] = None,
granularity: Optional[Granularity] = None,
filter: Optional[Expression] = None,
metrics: Optional[MetricNames] = None,
next_page_token: Optional[NextPageToken] = None,
sort_by: Optional[SortDefinition] = None,
max_results: Optional[MaxResults] = None,
) -> GetReservationCoverageResponse
Retrieves the reservation coverage for your account, which you can use to see how much of your Amazon Elastic Compute Cloud, Amazon Relational Database Service, Amazon ElastiCache, Amazon MemoryDB, Amazon Redshift, Amazon Elasticsearch Service, or Amazon OpenSearch Service usage a reservation covers. An organization's management account can see the coverage of the associated member accounts. The filter supports dimensions, tags, and cost categories, combined with one level of And or Not. For any time period, you can filter data about reservation usage by the following dimensions:
-
AZ
-
CACHE_ENGINE
-
DATABASE_ENGINE
-
DEPLOYMENT_OPTION
-
INSTANCE_TYPE
-
INSTANCE_TYPE_FAMILY
-
LINKED_ACCOUNT
-
PLATFORM
-
REGION
-
SERVICE
-
TAG
-
TENANCY
The dimensions that you can use depend on the service in the SERVICE filter. For details, see Filter.
To determine valid values for a dimension, use the GetDimensionValues operation with Context set to COST_AND_USAGE. Coverage filters apply to cost and usage data, so RESERVATIONS values such as Windows or Aurora don't match any coverage data. Use the COST_AND_USAGE spelling, such as Windows (Amazon VPC) or Aurora MySQL.
Parameters:
-
time_period(DateInterval) –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
startis2017-01-01andendis2017-05-01, then the cost and usage data is retrieved from2017-01-01up to and including2017-04-30but not including2017-05-01. -
group_by(Optional[GroupDefinitions], default:None) –You can group the data by the following attributes. The attributes that you can use depend on the service in the
SERVICEfilter. If you don't provide aSERVICEfilter, Cost Explorer uses Amazon Elastic Compute Cloud - Compute.-
Amazon Elastic Compute Cloud - Compute:
AZ,INSTANCE_TYPE,INSTANCE_TYPE_FAMILY,LINKED_ACCOUNT,PLATFORM,REGION, andTENANCY -
Amazon Relational Database Service:
AZ,DATABASE_ENGINE,DEPLOYMENT_OPTION,INSTANCE_TYPE,LINKED_ACCOUNT, andREGION -
Amazon ElastiCache and Amazon MemoryDB:
AZ,CACHE_ENGINE,INSTANCE_TYPE,LINKED_ACCOUNT, andREGION -
Amazon Redshift, Amazon Elasticsearch Service, and Amazon OpenSearch Service:
AZ,INSTANCE_TYPE,LINKED_ACCOUNT, andREGION
If you specify two
SERVICEvalues, use only attributes that both services support. You can specify up to four attributes, and only theDIMENSIONtype is supported. -
-
granularity(Optional[Granularity], default:None) –The granularity of the Amazon Web Services cost data for the reservation. Valid values are
MONTHLYandDAILY.If
GroupByis set,Granularitycan't be set. IfGranularityisn't set, the response object doesn't includeGranularity, eitherMONTHLYorDAILY.The
GetReservationCoverageoperation supports onlyDAILYandMONTHLYgranularities. -
filter(Optional[Expression], default:None) –Filters coverage data by dimensions. You can filter by the following dimensions:
-
AZ
-
CACHE_ENGINE
-
DATABASE_ENGINE
-
DEPLOYMENT_OPTION
-
INSTANCE_TYPE
-
INSTANCE_TYPE_FAMILY
-
LINKED_ACCOUNT
-
PLATFORM
-
REGION
-
SERVICE
Supported values for
SERVICEare Amazon Elastic Compute Cloud - Compute, Amazon Relational Database Service, Amazon ElastiCache, Amazon MemoryDB, Amazon Redshift, Amazon Elasticsearch Service, and Amazon OpenSearch Service. You can specify up to twoSERVICEvalues. -
TAG
-
TENANCY
The dimensions that you can use depend on the service in the
SERVICEfilter.CACHE_ENGINEapplies only to Amazon ElastiCache and Amazon MemoryDB.DATABASE_ENGINEandDEPLOYMENT_OPTIONapply only to Amazon Relational Database Service.INSTANCE_TYPE_FAMILY,PLATFORM, andTENANCYapply only to Amazon Elastic Compute Cloud - Compute. If you specify twoSERVICEvalues, use only dimensions that both services support.GetReservationCoverageuses the same Expression object as the other operations, with the following limits.Filteraccepts oneDimensions,Tags, orCostCategoriesexpression, aNotof one of these expressions, or oneAndof two or more of these. The operation doesn't supportOr, anAndinside anAnd, or aNotaround any other expression.Each dimension can appear only once in a filter, including inside a
Not.Tagsis the only exception: you can filter on more than one tag key. You can use only oneCostCategoriesexpression. To filter on several values of a dimension, put them in one expression. The operation ORs multiple values for a dimension together.If you don't provide a
SERVICEfilter, Cost Explorer defaults to EC2. -
-
metrics(Optional[MetricNames], default:None) –The measurement that you want your reservation coverage reported in.
Valid values are
Hour,Unit, andCost. You can use multiple values in a request.HourreturnsCoverageHours,UnitreturnsCoverageNormalizedUnits, andCostreturnsCoverageCost.Unitis supported only for Amazon Elastic Compute Cloud - Compute. If you don't specifyMetrics, the response includes onlyCoverageHours. -
next_page_token(Optional[NextPageToken], default:None) –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.
-
sort_by(Optional[SortDefinition], default:None) –The value by which you want to sort the data.
The following values are supported for
Key:-
OnDemandCost -
CoverageHoursPercentage -
OnDemandHours -
ReservedHours -
TotalRunningHours -
CoverageNormalizedUnitsPercentage -
OnDemandNormalizedUnits -
ReservedNormalizedUnits -
TotalRunningNormalizedUnits -
Time
If you specify
SortBy, you must also specifySortOrder. There is no default. Supported values forSortOrderareASCENDINGorDESCENDING. -
-
max_results(Optional[MaxResults], default:None) –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.
Raises:
-
DataUnavailableException–The requested data is unavailable.
-
InvalidNextTokenException–The pagination token is invalid. Try again without a pagination token.
-
LimitExceededException–You made too many calls in a short period of time. Try again later.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_cost_explorer/_services/cost_explorer.py
1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 | |