I created an access policy based on least privileges so that the user is only able to run queries in an Athena workgroup, called "finance-analyst-dev":
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "S3Permissions",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket",
"s3:GetBucketLocation",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::datalake-finance-0123456789123-analytics-dev",
"arn:aws:s3:::datalake-finance-0123456789123-analytics-dev/*"
]
},
{
"Sid": "AthenaPermissions",
"Effect": "Allow",
"Action": [
"athena:StartQueryExecution",
"athena:GetQueryExecution",
"athena:GetQueryResults",
"athena:ListQueryExecutions",
"athena:GetWorkGroup",
"athena:CreateNamedQuery",
"athena:DeleteNamedQuery",
"athena:GetNamedQuery",
"athena:ListNamedQueries",
"athena:BatchGetNamedQuery",
"athena:BatchGetQueryExecution",
"athena:UpdateNamedQuery",
"athena:ListWorkGroups"
],
"Resource": [
"arn:aws:athena:us-east-1:0123456789123:workgroup/finance-analyst-dev"
]
},
{
"Sid": "GluePermissions",
"Effect": "Allow",
"Action": [
"glue:GetDatabases",
"glue:GetTables",
"glue:GetTable",
"glue:GetPartitions"
],
"Resource": [
"arn:aws:glue:us-east-1:0123456789123:catalog",
"arn:aws:glue:us-east-1:0123456789123:database/finance-analytics-dev",
"arn:aws:glue:us-east-1:0123456789123:table/finance-analytics-dev/*"
]
}
]
}
When accessing the console, the user continues to be informed that he cannot execute the athena:GetWorkGroup
action on the resource:
I wouldn't want this user to access the primary workgroup.
All other permissions in this policy worked properly.