Allow access to the Athena Data Connector for External Hive Metastore
The permission policy examples in this topic demonstrate required allowed actions and the resources for which they are allowed. Examine these policies carefully and modify them according to your requirements before you attach similar permissions policies to IAM identities.
Example – Allow an IAM principal to query data using Athena Data Connector for External Hive Metastore
The following policy is attached to IAM principals in addition to the AWS managed policy: AmazonAthenaFullAccess, which grants full access to Athena actions.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor1", "Effect": "Allow", "Action": [ "lambda:GetFunction", "lambda:GetLayerVersion", "lambda:InvokeFunction" ], "Resource": [ "arn:aws:lambda:*:
111122223333
:function:MyAthenaLambdaFunction
", "arn:aws:lambda:*:111122223333
:function:AnotherAthenaLambdaFunction
", "arn:aws:lambda:*:111122223333
:layer:MyAthenaLambdaLayer
:*" ] }, { "Sid": "VisualEditor2", "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket", "s3:PutObject", "s3:ListMultipartUploadParts", "s3:AbortMultipartUpload" ], "Resource": "arn:aws:s3:::MyLambdaSpillBucket
/MyLambdaSpillLocation
" } ] }
Explanation of permissions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Allowed actions | Explanation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Allows queries to invoke the AWS Lambda functions specified in the
Resource block. For example,
arn:aws:lambda:*: ,
where MyAthenaLambdaFunction specifies the
name of a Lambda function to be invoked. Multiple functions can be
specified as shown in the example. |
Example – Allow an IAM principal to create an Athena Data Connector for External Hive Metastore
The following policy is attached to IAM principals in addition to the AWS managed policy: AmazonAthenaFullAccess, which grants full access to Athena actions.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "lambda:GetFunction", "lambda:ListFunctions", "lambda:GetLayerVersion", "lambda:InvokeFunction", "lambda:CreateFunction", "lambda:DeleteFunction", "lambda:PublishLayerVersion", "lambda:DeleteLayerVersion", "lambda:UpdateFunctionConfiguration", "lambda:PutFunctionConcurrency", "lambda:DeleteFunctionConcurrency" ], "Resource": "arn:aws:lambda:*:
111122223333
: function:MyAthenaLambdaFunctionsPrefix
*" } ] }
Explanation of Permissions
Allows queries to invoke the AWS Lambda functions for the AWS Lambda functions specified
in the Resource
block. For example,
arn:aws:lambda:*:
,
where MyAWSAcctId
:function:MyAthenaLambdaFunction
MyAthenaLambdaFunction
specifies the name of a Lambda
function to be invoked. Multiple functions can be specified as shown in the
example.