Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alecbw/a3bf6af7956c8390b38a5db04e044be6 to your computer and use it in GitHub Desktop.
Save alecbw/a3bf6af7956c8390b38a5db04e044be6 to your computer and use it in GitHub Desktop.
A policy you can attach to a role to enable the caller to write to S3 buckets (and corresponding Athena tables). NOTE: overwrite and overwrite-partitions require additional permissions
{
"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:GetDatabase",
"glue:GetPartitions"
],
"Effect": "Allow",
"Resource": [
"arn:aws:glue:us-west-1:YOURAWSACCOUNTID:*"
],
"Sid": "AccessGlueParts"
}
],
"Version": "2012-10-17"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment