- Newest
- Most votes
- Most comments
The error you're encountering with Athena when inserting data into your S3 table bucket appears to be related to the encryption configuration in your workgroup.
When running an INSERT query on a table with underlying data that is encrypted in Amazon S3, there can be compatibility issues with the query results encryption. The error code INTERNAL_ERROR_QUERY_ENGINE indicates an internal Athena error occurring on the query engine side, which in this case is likely related to how Athena is handling the encryption for your Iceberg table.
For Iceberg tables specifically, there are special considerations when working with encrypted datasets. Unlike regular tables where you might specify 'has_encrypted_data'='true' as a table property, Iceberg tables handle encryption differently.
Here are some steps to troubleshoot and potentially resolve this issue:
-
Verify that your IAM role has the necessary permissions to both access the encrypted data and use the KMS key specified in your workgroup configuration.
-
Check that you have the appropriate permissions for both Athena operations and KMS key usage, including
kms:Decryptfor working with encrypted datasets. -
Try simplifying your query to see if the error persists with a smaller data set or fewer operations.
-
If possible, check the Athena service status in your region to ensure there are no ongoing issues.
-
As a workaround, you could try using a workgroup without encryption for the insert operation, and then switch back to the encrypted workgroup for subsequent queries.
If the problem persists after trying these steps, you may need to contact AWS support for further assistance, as this appears to be an internal error within Athena's query engine when handling encrypted Iceberg tables.
Sources
INSERT INTO - Amazon Athena
ErrorCode: INTERNAL_ERROR_QUERY_ENGINE | AWS re:Post
Create iceberg tables based on encrypted datasets in Amazon S3 | AWS re:Post
It is known limitation https://docs.aws.amazon.com/athena/latest/ug/gdc-register-s3-table-bucket-cat.html
Relevant content
- AWS OFFICIALUpdated 3 years ago
