-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document which permissions are required #39
Comments
I have an IAM policy with the exact permissions that I need, I'll get it later tonight. It might not cover all use cases though. |
Should be a good starting point! |
Could I get some feedback on this? I'll make it pretty later, and maybe include a sample policy in JSON format too.
|
This worked for my first deploy. On subsequent deploys the upload succeeded, but S3 threw up a 403 when I tried to load the site in a browser. Updating all files to be public allowed the site to load correctly again. Removing |
With Configuring a bucket policy and disabling ACLs is recommended, because ACLs are considered legacy by Amazon. "As a general rule, AWS recommends using S3 bucket policies or IAM policies for access control. S3 ACLs is a legacy access control mechanism that predates IAM." |
Yup, that worked for me. Thanks! |
This looks good! |
I have applied all these permissions on a new bucket, with
I use a dedicated user for CI, and attached this policy to the user, and have the bucket policy for public access. I was able to deploy the first time, but not after that and I manually created the bucket. Do we have a concise set of steps and settings needed to get this working all the way on the first shot? I'm ok with giving this free reign on that particular bucket, the content is reproducible after all. {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutAccountPublicAccessBlock",
"s3:GetAccountPublicAccessBlock",
"s3:ListAllMyBuckets",
"s3:HeadBucket"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::mysite.com/*",
"arn:aws:s3:::staging.mysite.com/*",
"arn:aws:s3:::mysite.com",
"arn:aws:s3:::staging.mysite.com"
]
}
]
} As a suggestion, it might be nice to better print debug info for non-advanced users as I had to look through the source to find what action I'm very thankful for this package, as it really helps solve one of the most boring, and boilerplate tasks for a S3 static site. I'm so close! |
@chris-erickson I just got this setup for me and was running into similar issues. This is the IAM policy I created:
|
Thanks, somehow GetBucketLocation got lost, but I still am having the same error. For me I:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation"
],
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": [
"s3:PutBucketWebsite",
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:DeleteObject"
],
"Resource": [
"arn:aws:s3:::mysite.com/*",
"arn:aws:s3:::staging.mysite.com/*",
"arn:aws:s3:::mysite.com",
"arn:aws:s3:::staging.mysite.com"
]
}
]
} This policy is attached to the CI user which has access key/id added. 🤷♂️ |
Hi @chris-erickson , My IAM policy also includes HeadBucket (not sure if this is necessary) and PutObjectAcl (which theoretically shouldn't be necessary with |
@JoshuaWalsh the And in my IAM policy, I left out the @chris-erickson for my configuration, I was also able to set all the "Manage public access control lists (ACLs)" and "Manage public bucket policies" options to If you're still having issues, what I did to see where I was failing was to install the |
It should show the stacktrace on errors by default, but the AWS SDK is probably throwing some weird non default error object without a stacktrace. |
This is perfectly working, but does not make the Cloudfront invalidation.
|
Something I just discovered: If you're allowing gatsby-plugin-s3 to create the bucket for you, you may also need |
For frustrated developers arriving here from google... One cause of the error:
Is a non-unique S3 bucket name. The plugin will attempt to get info on the bucket name you specified before doing its other work. If you don't own that bucket (since someone else already has the name you picked) it will quite rightly fail with a 403 and give you an error message that is about as much use as a chocolate tea pot. |
still facing:
after a |
bump on adding this to the README |
We're currently suggesting people should give admin access to their IAM accounts in the README, this is probably not a very secure thing to suggest.
We should figure out which exact permissions the plugin needs and document them, preferably through a JSON policy.
The text was updated successfully, but these errors were encountered: