Created
December 29, 2020 20:22
-
-
Save alecbw/1075fb840926da9422fe53c02b87d220 to your computer and use it in GitHub Desktop.
A policy you can attach to a role to enable the caller to read from Athena tables. s3:PutObject is required to put the query results CSV in the query result bucket.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Statement": [ | |
{ | |
"Action": [ | |
"s3:ListBucket", | |
"s3:GetBucketLocation" | |
], | |
"Effect": "Allow", | |
"Resource": [ | |
"arn:aws:s3:::bucket-your-data-is-in", | |
"arn:aws:s3:::bucket-specified-for-athena-query-results", | |
], | |
"Sid": "FindAndScanStagingBuckets" | |
}, | |
{ | |
"Action": [ | |
"s3:GetObject", | |
"s3:PutObject" | |
], | |
"Effect": "Allow", | |
"Resource": [ | |
"arn:aws:s3:::bucket-your-data-is-in/some-subfolder/*", | |
"arn:aws:s3:::bucket-specified-for-athena-query-results/*", | |
], | |
"Sid": "GetAndPutAthenaAndPublicResults3Objects" | |
}, | |
{ | |
"Action": [ | |
"glue:GetTable", | |
"glue:GetTables", | |
"glue:SearchTables", | |
"glue:GetTable", | |
"glue:GetDatabase", | |
"glue:GetPartitions" | |
], | |
"Effect": "Allow", | |
"Resource": [ | |
"arn:aws:glue:us-west-1:YOURAWSACCOUNTID:*" | |
], | |
"Sid": "AccessGlueParts" | |
}, | |
{ | |
"Action": [ | |
"athena:StartQueryExecution", | |
"athena:CancelQueryExecution", | |
"athena:StopQueryExecution", | |
"athena:GetQueryExecution", | |
"athena:GetQueryResults", | |
"athena:GetWorkGroup" | |
], | |
"Effect": "Allow", | |
"Resource": [ | |
"arn:aws:athena:us-west-1:YOURAWSACCOUNTID:*" | |
], | |
"Sid": "EnableAthenaQueries" | |
} | |
], | |
"Version": "2012-10-17" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment