Make a bucket public in Amazon S3

Amazon Web-ServicesAmazon S3

Amazon Web-Services Problem Overview


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

Amazon Web-Services Solutions


Solution 1 - Amazon Web-Services

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.

Solution 2 - Amazon Web-Services

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVictorView Question on Stackoverflow
Solution 1 - Amazon Web-ServicesIntricationsView Answer on Stackoverflow
Solution 2 - Amazon Web-ServicesevaneusView Answer on Stackoverflow