devroom.io/drafts/2010-12-24-public-readable-amazon-s3-bucket-policy.md
Ariejan de Vroom dbae98c4c0 Moar updates
2013-03-24 14:27:51 +01:00

1.0 KiB

title kind slug created_at tags
Public Readable Amazon S3 Bucket Policy article public-readable-amazon-s3-bucket-policy 2010-12-24
amazon
s3
cloudfront
bucket policy

Amazon S3 allows you to set per-file permissions to grant read and/or write access. This is nice, but sometimes you just want to share your whole bucket with the world.

Luckily, Amazon features bucket policies, which allow you to define permissions for an entire bucket. ~ This example will give read access to Everyone on all files in your bucket.

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

Make sure you replace bucket in arn:aws:s3:::bucket/* with your bucket name.

After setting this bucket policy (see 'Bucket -> Properties -> Add Bucket Policy'), all your files will be publicly readable.