AccessDedied Error on trying to exec athena quey from python/boto3

0

Error details com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied;

I'm starting a query execution in python (boto3) and checking whether it finishes. But I'm always getting a FAILED status message. On the other hand, when I check the recent queries in Athena I can see the message above. My intention is to start the query, check completion and download the result file from S3 bucket. Can anyone help? Thanks!

  • Where is your python (boto3) code being executed? Lambda? EC2? Fargate?

2개 답변
0
수락된 답변

When calling Athena from a Lambda function, you need to ensure the Lambda function's execution role has permission to access your Amazon S3 buckets. That same logic applies to other ways you can run your code, such as Amazon EC2 or Amazon ECS, and includes both the source bucket and the destination bucket. For example, take a look at the AWS Managed Rule AmazonAthenaFullAccess below. Note that this includes actions like s3:PutObject and s3:AbortMultipartUpload that Athena may use to create temporary files, not just read actions like S3:GetObject or S3:ListBucket.

Relevant Links:

AWS
David
답변함 일 년 전
profile picture
전문가
검토됨 한 달 전
0

Thanks! It was a matter of adding the right permissions to the user's role.

답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠