- Newest
- Most votes
- Most comments
The error you're encountering is related to AWS KMS throttling when Glue is trying to access encrypted data. This happens because you've exceeded the rate limit for KMS API calls when Athena is attempting to retrieve partition information from the Glue Data Catalog.
This throttling exception occurs when there are too many concurrent requests to the AWS KMS service, which is being used to decrypt data in your Glue catalog. The error specifically mentions "You have exceeded the rate at which you may call KMS."
To resolve this issue, you can try the following approaches:
-
Retry your query after a short delay, implementing an exponential backoff strategy where you wait progressively longer between retries.
-
If you're running multiple queries simultaneously, try to reduce the number of concurrent queries to stay within the KMS service limits.
-
Request a service quota increase for AWS KMS API calls if you consistently need to run many concurrent queries.
-
If possible, optimize your table partitioning strategy to reduce the number of partitions that need to be processed for each query.
-
Consider implementing caching mechanisms if you're repeatedly querying the same data.
This is a common issue when working with encrypted data in AWS Glue and Athena, especially when running multiple concurrent queries or when dealing with tables that have many partitions.
Sources
Access denied error in Athena | AWS re:Post
Glue Throttling Exception | AWS re:Post
answered a year ago
Your Athena/Data Lake query is failing because: The Glue Data Catalog table you are querying uses a KMS-encrypted Glue connection or metadata. When Athena queries Glue, Glue must call AWS KMS to decrypt the table metadata. Your table has many partitions, causing too many rapid KMS decrypt requests. KMS enforces a rate limit → Throttle → Glue fails → Athena fails. This is why the error chain contains: AWSKMS ThrottlingException GlueEncryptionException FederationSourceException Error calling Glue getPartitions This is not an Athena issue, but a KMS throttling due to Glue partition scanning.
Solution 1 — Use an AWS-Managed KMS Key AWS-managed keys have much higher KMS rate limits than customer-managed CMKs. If your Glue Data Catalog table is encrypted using a customer-managed KMS key, switch it to: aws/glue (AWS-managed Glue key) Or turn off catalog encryption if your organization allows it.
Solution 2 — Request a KMS Throttle Increase If your security team requires CMKs: Open a support ticket with AWS: Category: KMS → Throttling / Quotas Request increased KMS TPS for your CMK AWS will raise: Encrypt TPS Decrypt TPS API call rate limit This is a common request for Glue, EMR, Athena, and Lake Formation workloads.
Solution 3 — Reduce Number of Glue Partitions If your table is excessively partitioned: Merge partitions Use hourly → daily or daily → monthly partitions Use partition projection (no partitions stored in Glue) Partition Projection = Best Athena Optimization It avoids Glue calls entirely → no KMS calls → no throttling.
Solution 4 — Cache Glue Partitions (ETL Approach) If using an ETL job or external process: Use GetPartitions once Cache results Reuse cache instead of re-querying Glue This reduces KMS decrypt calls.
answered a year ago
