LocalStack

CloudWatch get-metric-data fails with list index error when querying 10+ metrics

warning
configurationUpdated Jul 10, 2024(via Exa)
Technologies:
How to detect:

CloudWatch GetMetricData API calls fail with 'list index out of range' exception when requesting 10 or more metrics simultaneously in older LocalStack versions. The operation succeeds with 9 or fewer metrics, indicating an off-by-one or pagination issue in metric query handling.

Recommended action:

Update to the latest LocalStack docker image by running 'docker pull localstack/localstack:latest' (or localstack-pro variant). Alternatively, enable the newer v2 CloudWatch provider by setting environment variable PROVIDER_OVERRIDE_CLOUDWATCH=v2, which provides more stable metric handling.