I followed the tutorial http://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html. I set up a IAM user (with strange permissions) and a S3-bucket and could query sample Athena tables and the outputs were written to my S3-bucket. Now I have credentials from a client to access his Athena table. This doesn't work and I get following error:
Access denied when writing output to url: s3://my-test-bucket/b36-f3c0-482-a225-34d63d355.txt . Please ensure you are allowed to access the S3 bucket. If you are encrypting query results with KMS key, please ensure you are allowed to access your KMS key
My S3-bucket is as public as it gets. Permissions for "Any authenticated AWS user" : Read, Write. Permissions for "everyone" : Read, Write. Permissions for "Log delivery" : Read, Write. "Permission Access" for everything: Read, Write
Bucket Policy allows everyone to do everything.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::my-test-bucket"
},
{
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
],
"Resource": "arn:aws:s3:::my-test-bucket/*"
},
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::my-test-bucket/*"
}
] }
CORS configuration:
<?xml version="1.0" encoding="UTF-8"?> <CORSConfiguration
xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<AllowedHeader>*</AllowedHeader> </CORSRule> </CORSConfiguration>
Still, I get the error: Access denied when writing output to url...
Edit: From time to time I get an other error instead: "Unable to verify/create output bucket my-test-bucket". Not sure why I get different errors.
What can I do?