2

Public Readable Amazon S3 Bucket Policy

 3 years ago
source link: https://www.devroom.io/2010/12/24/public-readable-amazon-s3-bucket-policy/?utm_campaign=Feed%3A+ariejan+%28ariejan%7Cdevroom.io%29
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Public Readable Amazon S3 Bucket Policy

Posted: 2010-12-24 - Last updated: 2019-06-05

Tagged 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.

{
	"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.

My site is free of ads and trackers. I record privacy-respecting usage statistics with Fathom.

Was this post helpful to you? Why not ☕ Buy me a coffee

Copyright © 1999-2020 Ariejan de Vroom <[email protected]>

Live now; make now always the most precious time. Now will never come again.
    – Jean-Luc Picard


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK