AWS Bucket Policies

Written by James McDonald

June 11, 2017

Been working towards my Amazon Certified Solutions Architect — Associate qualification.

Created a static website from an S3 bucket and everytime I synced my local files up to it I would get access denied due to the sync removing perms.

But that is where bucket policies come in you just need to add one that allows everyone to read it.

You can copy and edit one in the docs: https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html#example-bucket-policies-use-case-2

or use the policy generator http://awspolicygen.s3.amazonaws.com/policygen.html

Either way you end up with a policy that will enable public read for all objects in your bucket and stop an aws s3 sync . s3://bucketname  wiping out your ACL

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

 

 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

Scam call from “Telstra”

Just had a call from a man with a sub-continental accent from caller ID 0734946596 Told me there was problem with my...

PC Build

I recently built myself a PC using the SilverStone SG13 Case. I am planning to use it as a Hot Spare. So any client...