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 *

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.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...