-
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
Deploying to s3 with CloudFront - Access Denied. #111
Comments
Please try adding the following permissions:
If that doesn't help, please make a note of which stage of deployment it reaches before you get the Access Denied error. Thanks! |
Hello, There is an issue with this library not being able to work with named AWS profiles; I think it only ever uses the default profile. The deployment only worked when i deleted my ./aws/ directory and ran aws configure again. I need a way to pass an argument in like --profile xxx so that the deployment uses that profile for permissions. The
I hope this clarifies; but I do feel that the library needs to support AWS named profiles; I had thought that |
Interesting, we just use the defaults for aws-sdk. According to this the SDK uses the AWS_PROFILE environment variable if it's present, could you perhaps try that? I think AWS_DEFAULT_PROFILE is only used by the cli. |
Yes thats what I mean, this plugin should allow a profile name to be set as part of its config, and ultimately it would be passed into here somewhere; var credentials = new AWS.SharedIniFileCredentials({profile: 'work-account'}); So if its blank, use default, otherwise use the profile provided; be it 'work-account'. For any developer who uses one AWS for their blog, and a different account for work or a client, this would be much needed (My use case fits this, but as Gatsy is a common blog for Developers... probably many others). |
This also means .env is not needed - correct? |
I think it isn't necessary to pass the profile in via code like that. If you provide it in the I don't think .env will have any effect, at least not until we do #48. |
I was setting it as the env variable, right in my first post I said this;
It still doesnt seem to be picked up by gatsby-plugin-s3 - could you try doing this at your end? Make a junk default, then use a named profile as your usual? |
You're setting |
Thanks Joshua, I am so sorry, I didn't spot the name change in your message. Might be worth something like so being added to the documentation, it is how to set profile and also invalidate CloudFront cache.
|
I trust it works now that you're using AWS_PROFILE? If so, that's great. WRT the CloudFront invalidation, did you see this? It probably is worth documenting, but I'm not sure where it would go. At least now if someone Googles it they should find this thread. |
Hello,
A head scratcher as I am following all the guides I can find, but here is what I have; I have used example instead of the domain.
I have a s3 bucket which is www which holds the site. A non-www which redirects. A cloudfront which has two distributions; one for each bucket and they forward http to https.
The current non-deployed, old gatsby site is working fine in terms of redirects; but I no longer seem able to deploy... might be CloudFront based.
My Gatsby Config
I have a .env file, with the correct KEY etc in, but as I also have a few profiles on my machine I have this command; example will be the name of my aws/credentials profile which again has the right keys.
The ACL on my bucket;
This is the command I run;
The text was updated successfully, but these errors were encountered: