Athena IAM permissions
Sortment needs access to Athena, Glue, and S3 to run queries, manage tables, and move data. This section assumes three logical S3 locations:
Buckets and resources
s3StagingDir
Athena query results
All queries (OutputLocation)
s3DataDir
Iceberg table data
createTable, other DDL operations. Falls back to s3StagingDir if empty
Blob bucket
Import/export data (blobs/CSV files)
syncBlobToWarehouse (read), syncWarehouseToBlob (write)
1. Athena service permissions
Grant these permissions on the workgroup used by Sortment:
json{
"Effect": "Allow",
"Action": [
"athena:StartQueryExecution",
"athena:GetQueryExecution",
"athena:GetQueryResults",
"athena:GetTableMetadata",
"athena:ListTableMetadata",
"athena:GetWorkGroup"
],
"Resource": "arn:aws:athena:<region>:<account>:workgroup/<workGroupName>"
}GetTableMetadataandListTableMetadataare used to fetch catalog information (for example,getFullCatalog()).GetWorkGroupvalidates that the configured workgroup exists before running queries.
2. Glue catalog permissions
Glue is Athena’s metadata store. For writeable schemas (Sortment can create/alter/drop tables):
CreateDatabase→CREATE DATABASE IF NOT EXISTS <schema>beforecreateTable().UpdateTable→ALTER TABLE ADD/DROP COLUMN, table renames.DeleteTable→DROP TABLEplus cleanup when S3 metadata is missing.BatchCreatePartition,GetPartitions,BatchDeletePartition→ required by Iceberg for partition management.
For read‑only schemas (query‑only data):
3. S3 permissions
Query results bucket (s3StagingDir)
Every query writes results here. Required by Athena:
Table data bucket (s3DataDir)
Iceberg table data is stored here. If s3DataDir is empty, this is the same as s3StagingDir, and permissions must be merged.
DeleteObject→ required by Iceberg forDROP TABLEand compaction.AbortMultipartUploadandListMultipartUploadParts→ required for large Iceberg writes.
Blob bucket (import/export)
Used by blob‑level sync operations:
syncBlobToWarehouse→ reads from the blob bucket and loads into warehouse tables.syncWarehouseToBlob→ writes to the blob bucket using multipart uploads (@aws-sdk/lib-storageUpload), hence multipart permissions.
4. Scenario summary
Use this matrix to verify access for each flow:
Scenario
Athena
Glue
s3StagingDir
s3DataDir
Blob bucket
Read queries (SELECT)
All above
GetTable / GetDatabase
PutObject / GetObject
GetObject
—
Create / alter tables
All above
All writeable actions
PutObject / GetObject
PutObject / GetObject / DeleteObject
—
Drop tables
All above
DeleteTable
PutObject / GetObject
DeleteObject
—
syncBlobToWarehouse
All above
CreateTable / DeleteTable
PutObject / GetObject
PutObject
GetObject
syncWarehouseToBlob
All above
GetTable
PutObject / GetObject
GetObject
PutObject + multipart upload actions
loadCSVIntoWarehouseFromBlob
All above
CreateTable / DeleteTable
PutObject / GetObject
PutObject
GetObject
5. Notes
If
s3DataDiris empty The data and staging directories share the same bucket; add data permissions to the staging bucket/prefix.IAM roles vs access keys If using IAM roles (for example, EC2/ECS task roles), attach these policies to the role and you do not need to configure
accessKeyId/secretAccessKeyin Sortment.Glue resource scope
glue:CreateDatabaserequires both thecatalogARN and the specificdatabaseARN to be present inResource.s3:ListBucketscopes3:ListBucketmust be granted onarn:aws:s3:::<bucket>, not only onbucket/*, which is why each S3 block includes both the bucket and prefix ARNs.
Last updated