By Victor


2010-03-30 16:57:02 8 Comments

How can I set a bucket in Amazon S3 so all the files are publicly read-only by default?

2 comments

@evaneus 2012-06-08 15:54:18

Amazon provides a policy generator tool:

https://awspolicygen.s3.amazonaws.com/policygen.html

After that, you can enter the policy requirements for the bucket on the AWS console:

https://console.aws.amazon.com/s3/home

@Timothy.Li 2017-11-16 10:24:55

this is official document of <<Using Bucket Policies and User Policies>> docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.h‌​tml

@Intrications 2011-01-17 01:48:27

You can set a bucket policy as detailed in this blog post:

http://ariejan.net/2010/12/24/public-readable-amazon-s3-bucket-policy/


As per @robbyt's suggestion, create a bucket policy with the following JSON:

{
  "Version": "2008-10-17",
  "Statement": [{
    "Sid": "AllowPublicRead",
    "Effect": "Allow",
    "Principal": { "AWS": "*" },
    "Action": ["s3:GetObject"],
    "Resource": ["arn:aws:s3:::bucket/*" ]
  }]
}

Important: replace bucket in the Resource line with the name of your bucket.

@silvenon 2015-02-18 16:03:05

When using official AWS CLI arn:aws:s3:::bucket also needs to be added to the Resource array. (So without the /*.) I hope this helps others who were struggling with this like me.

@silvenon 2015-02-18 16:05:25

My bad. This is needed only if you plan to sync, not just view the bucket.

@Chris Betti 2015-07-07 19:33:32

To support anonymous access through python's boto, in addition to setting this policy, I also had to grant List privilege to Everyone in the Properties > Permissions section of the bucket.

@Timothy.Li 2017-11-16 10:11:29

what is the rule of writeing Version? I am using current date 2017-11-16, it reports:Error: The policy must contain a valid version string

@froggomad 2018-02-16 14:22:19

@Timothy.Li did you remember to wrap it in quotes? "2017-11-16",

@Walter Monecke 2019-02-22 16:39:34

I am getting Access denied when doing this.

@P_O_I_S_O_N 2019-03-05 05:18:34

docs.aws.amazon.com/AmazonS3/latest/dev/… Refer this Documentation will help you to fix this

Related Questions

Sponsored Content

26 Answered Questions

[SOLVED] Downloading an entire S3 bucket?

8 Answered Questions

[SOLVED] how to delete files from amazon s3 bucket?

8 Answered Questions

[SOLVED] FTP/SFTP access to an Amazon S3 Bucket

  • 2014-05-29 17:20:52
  • zgall1
  • 187211 View
  • 121 Score
  • 8 Answer
  • Tags:   ftp amazon-s3 sftp

24 Answered Questions

[SOLVED] Quick way to list all files in Amazon S3 bucket?

  • 2010-07-26 18:43:35
  • Steve
  • 162990 View
  • 117 Score
  • 24 Answer
  • Tags:   amazon-s3

15 Answered Questions

[SOLVED] How do you search an amazon s3 bucket?

12 Answered Questions

[SOLVED] Setting up FTP on Amazon Cloud Server

29 Answered Questions

[SOLVED] Permission denied (publickey) when SSH Access to Amazon EC2 instance

2 Answered Questions

[SOLVED] How to revoke public permissions from a Amazon S3 Bucket

2 Answered Questions

[SOLVED] How to make all Objects in AWS S3 bucket public by default?

1 Answered Questions

[SOLVED] URL for public Amazon S3 bucket

Sponsored Content