newsdev/who-the-hill

Specifying how to make S3 bucket public, read-only

Closed this issue · 0 comments

When trying to implement this locally, I ran into the issue of only getting the text with names back. No image was returned.

Some snooping led me to the following Bucket Policy JSON:

{
  "Version": "2008-10-17",
  "Statement": [{
    "Sid": "AllowPublicRead",
    "Effect": "Allow",
    "Principal": { "AWS": "*" },
    "Action": ["s3:GetObject"],
    "Resource": ["arn:aws:s3:::who-the-hill/*" ]
  }]
}

This snippet makes it so your bucket is public and read-only, thus allowing Twilio to access the uploaded image and send it in a response. In addition, I granted List privilege to Everyone in the Permissions section of the bucket.

Would it be worth specifying this in the documentation?