ce:GetCostAndUsage returns "data not available for the requested time period" - why
Explains why ce:GetCostAndUsage returns data not available for the requested time period: future dates, ranges older than twelve months, billing lag, or granularity mismatches. Use when the call succeeds but returns no data. Key trigger: the exact data-not-available message with a 200 response.
TL;DR: The call is fine; the time period is not. Billing data lags about a day behind real time, Cost Explorer keeps roughly twelve months of history, and it cannot show the future, so shrink the window into the valid range and retry. If the range is valid, check that you are querying the payer account and that Cost Explorer is actually enabled.
The response that confuses everyone:
data not available for the requested time periodHTTP 200, no error code, just an empty result where cost data should be.
Check the end date first: it must not be in the future, and because billing data lags, end it at yesterday, not today. Expected: with End set to yesterday or earlier, data starts appearing.
Check the start date: Cost Explorer retains about twelve months, so a start date older than that returns nothing. Expected: moving Start inside the twelve-month window returns data.
Narrow the window and simplify: try a single recent full month with MONTHLY granularity before retrying the original wide or daily query. Command:
aws ce get-cost-and-usage --time-period Start=2026-09-01,End=2026-10-01 --granularity MONTHLY --metrics BlendedCostExpected: this baseline query returns data, proving the API and permissions work.Verify the account: member accounts in an Organization see only their own usage, and Cost Explorer must be enabled in the account you are querying, which takes up to a day on first enablement. Expected: you are querying the account that actually holds the data.
Rebuild the original query incrementally from the working baseline, widening one dimension at a time until it breaks. Expected: you find the exact dimension, usually the end date or the granularity, that empties the result.
Use this when
- GetCostAndUsage returns 200 with the data-not-available message instead of cost rows
- A dashboard or agent shows blank billing panels for recent dates
- The same query works for last month but not for this week
- You are unsure whether the problem is permissions or the time period
Not for this skill when
- The API returns AccessDeniedException, which is the permissions gate, not the data gate
- The error is InvalidTimeRangeException, which means the dates are malformed, not merely empty
- The query throttles, which is a backoff problem
Variant phrasings
- GetCostAndUsage no data returned
- cost explorer empty for requested time period
- billing data not available yet
- cost explorer blank for current month
Why it happens
Cost Explorer is a reporting pipeline, not a live meter. Usage records flow through collection, rating, and aggregation with roughly a day of lag, history is retained for about a year, and the future has no data by definition. The API answers honestly with an empty result instead of an error, which reads as a bug to callers expecting either data or an exception.
Edge cases
- The first of the month is the worst day for this: the prior month is finalizing and the current month has almost no data, so both directions look empty
- Daily granularity over a wide range can return empty where monthly succeeds; the granularity interacts with the window, not just the dates
- Amortized and blended cost views can differ on which periods have data during credit and refund adjustments
- A newly enabled Cost Explorer backfills slowly; the console may show partial months for the first day
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_5vFW7ErfoFouVLu5-8WgQg