- Newest
- Most votes
- Most comments
The issue you're experiencing in Scenario 2 might be related to the way that CloudWatch handles time periods in GetMetricData queries. When you specify a time range and a period, CloudWatch returns data for that period across the entire time range you've specified. This means that if your time range is shorter than your period, you might not get any data back.
In your example, you're using a period of 30 minutes and a time range of 30 minutes (from 16:45 to 17:15). This means that CloudWatch is trying to return data for a single period across the entire time range. If there is no data available for that entire period (which could be the case if your data is not evenly distributed across the time range), then you won't get any data back.
To work around this issue, you could try reducing the period to a smaller interval (e.g., 5 minutes) or expanding the time range to cover multiple periods. Alternatively, you could try using a different query that does not rely on the period parameter (e.g., using the StartTime and EndTime parameters to specify a specific time range).
Additionally, it's worth noting that the maximum number of allowed metrics in a GetMetricData query is not just based on the number of dimensions or metric names, but also on the number of periods and time ranges specified in the query. If your query includes too many periods or time ranges, you may still hit the maximum allowed metrics limit even if you're not exceeding the limit in other areas.
Relevant content
- asked 6 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 10 months ago
Thank you very much for your answer.
You said that the data could not be queried because the period and time range were not coordinated. But I did try to change the period to 5mins or even 1mins for a time range of 30m but still get no data returned. Then I did another try as follows:
I am very sure that there was only one data point at this time range, so I was confused about this phenomenon. Did this relate to the huge data point posted before the current query time range?