- New bucket
- Remove block public access
Bucket Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::bay-meadow-farms/*"
]
}
]
}
CORS Config
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
<AllowedHeader>Content-Length</AllowedHeader>
</CORSRule>
</CORSConfiguration>
yarn add gatsby-plugin-s3
gatsby-config.js
{
resolve: `gatsby-plugin-s3`,
options: {
bucketName: "bay-meadow-farms",
acl: null,
region: "us-west-1",
// protocol: "https",
// hostname: process.env.REACT_APP_HOST_NAME || "fake-host",
},
},