Use Cost Explorer APIs
The Cost Explorer API allows you to query your cost and usage data. You can query total, idle, and unallocated cloud costs in your cluster or Application. The response helps you to understand your primary cost contributors. You can use this data to manage and optimize your cost and resources.
Currently, these APIs can provide data for up to the last seven days. If you do not specify StartTime
and EndTime
or the specified time value is greater than seven days, it returns an exception error.
This topic lists examples of export data API usage.
Before You Begin
Example 1: Get Total, Idle, and Unallocated Cost Across Your Clusters
Use this sample query to get the total
, idle
, and unallocated
cost across your clusters.
You can also specify a limit
and offset
to the query. Limit specifies the number of entries that will be returned and offset specifies the index from start.
The time values passed for these queries follow Unix Time. You can use Epoch and Unix Timestamp Conversion Tools to convert.