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…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...