Reputation: 3860
I've done a lot of searching but find myself very confused and overwhelmed. I am creating a React-built website on Node and want to be able to load some data I will be storing in S3. Reading up on the documentation, AWS says that its best to not use any access keys but instead use an IAM credential. However, it is not clear to me exactly how I lode these IAM credentials in js so I can then download some objects from my personal bucket in S3. Does anyone have any good direction they can point me too in regards to properly, and securely, having Node access and download data from my S3 bucket? Thanks!
Upvotes: 1
Views: 100
Reputation: 78613
Presumably you are using EC2 to run your Node.js application.
Launch your EC2 instance(s) with an appropriate IAM role that has associated policies that allow access to the relevant objects in S3 (and any other resources/APIs your application needs). This is standard AWS and here's an intro video.
Your JavaScript code, assuming that it is using the AWS JavaScript SDK, can then seamlessly retrieve credentials on your application's behalf and they will be rotated automatically. You do not have to explicitly provide credentials.
See IAM Role Management FAQs here.
Upvotes: 2
Reputation: 1707
You can save credentials in C:\Users\USER_NAME.aws\credentials file. You should not save these credentials in project files. Please have a look at this article for further information. http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html
Upvotes: 1