0

I have updated the bucket policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1536491056397",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::gdesign",
                "arn:aws:s3:::gdesign/*"
            ]
        }
    ]
}

But still get access denied error when I try to access the image url: https://gdesign.s3.us-east-2.amazonaws.com/1536491951672

What else do I need to update on aws?

kittu
  • 6,662
  • 21
  • 91
  • 185
  • Change to `"Resource": [ "arn:aws:s3:::gdesign", "arn:aws:s3:::gdesign/*"`. You've given access to the bucket or root folder, but not to anything within. – Vineet Sep 09 '18 at 11:48
  • @Vineet Still the same issue – kittu Sep 09 '18 at 11:55
  • probably looks like you have mixed IAM and Bucket Policy. Try using this: https://awspolicygen.s3.amazonaws.com/policygen.html – Varun Chandak Sep 10 '18 at 07:38

2 Answers2

1

Choosing the correct region while creating bucket fixed my issue.

kittu
  • 6,662
  • 21
  • 91
  • 185
  • What do you mean by correct region? I didn't understand how you could select an in-correct region. – Vineet Sep 11 '18 at 05:29
  • I'm also curious about this, seems like if I choose a region for the aws object, i get a proper url but access denied – jones Apr 23 '19 at 13:49
  • @jones Choose your region(country) while selecting the region in dropdown – kittu Apr 24 '19 at 07:57
0

Im using PHP S3 lib, version 3.82.5, i got access defined when show img in webside too, my solution is when get img url from S3, u may need to call "createPresignedRequest" (Create a pre-signed URL for the given S3 command object) this function. Then every thing will be fine.