John Dunlea
John Dunlea

Reputation: 201

Make uploaded files to S3 public by default

I have tried a bunch of suggested solutions from Stack Overflow and other sites, but to no avail.

I have a bucket which I am uploading files to from a web page using one of the IAM accounts that I have created. These uploaded files are located within dynamically created folders within my parent bucket.

I need to ensure that any folder which is created along with any uploaded files held within the newly created folder are all public so any user can see them and download them.

Currently I am using the "S3 browser" application however it is not allowing me to download any of the uploaded files (although I can actually see them).

Any help is greatly appreciated!

Upvotes: 17

Views: 9537

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 270274

Create a Bucket Policy on that specific bucket, which grants GetObject permissions for anonymous users. Replace "examplebucket" with the name of the bucket. You can add the Bucket Policy in the Amazon S3 Management Console, in the Permissions section.

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

Upvotes: 26

Related Questions