I'm following this guide to deploy to an S3 bucket using Gatsby.
If I run aws s3 ls mybucketname.com
,
I get the single file I uploaded: 2019-02-15 15:53:58 477 favicon-16x16.png
However, if I run npm run deploy
,
I get this error:
> gatsby-plugin-s3 deploy
✖ Failed.
AccessDenied: Access Denied
Here is the relevant code in my gatsby-config.js
:
plugins: [
{
resolve: `gatsby-plugin-s3`,
options: {
bucketName: 'mybucketname.com'
},
},
Here is the IAM policy attached to the user I created in AWS:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListObjectsInBucket",
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::mybucketname.com"
]
},
{
"Sid": "AllObjectActions",
"Effect": "Allow",
"Action": "s3:*Object",
"Resource": [
"arn:aws:s3:::mybucketname.com/*"
]
}
]
}
Is there something else I can run to determine where this error is coming from?
Try setting acl: null
in gatsby-plugin-s3 options then run gatsby build
plugins: [
{
resolve: `gatsby-plugin-s3`,
options: {
bucketName: 'mybucketname.com',
acl: null
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With