AWS Bucket Policies

Been working towards my Amazon…

Login

Blog History

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 *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.