Athena query "Access denied when writing to location: s3://***"


As the title, i've try to test a query to create a new database. The workgroup been set, Enter image description here and the query is pretty simple like this along with the error. Enter image description here So i checked the iam, seems fine Enter image description here Then the s3 policy Enter image description here

And the odd part is the query result is failed, but the database is actually been created.

BTW, ive try the create a new table in this database too, same error of failed, but table is created. Is anyone can help me to solve this?

asked 2 years ago2007 views
1 Answer

I request you to check a few more things on your end:

  • Are there any Access Control Lists enabled on your bucket? If yes, please check whether the account has the write permissions or not.
  • Are the s3 bucket and the Athena not in the same account? If you are trying to access the s3 bucket which is in an account other than the account from which this Athena query has been run, then please follow this documentation.
  • I think that within your bucket policy, another resource might be missing which is 'arn:aws:s3::<your-bucket>'. Please try to add this as well.
  • Please check if there are any group permissions that are added on top of your role which is preventing the access to the s3 bucket for writing data.
profile pictureAWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions