All Posts

Adding S3 Credentials for Node.js AWS SDK

My go-to method for gaining access to AWS using the Node.js tooling.

Long story short, it's Amazon — there are way too many ways to set credentials.

Though my preferred method is not the recommended way, I find that it plays well with setting other environment-based values for your application. That is by using environment variables.

The AWS SDK automatically looks for your credentials in environment variables. You can set the following values:

Then it'll just work, like magic!

A big benefit to this approach is that you can have multiple projects on your machine and set these values contextually based on the project you're working with.

To learn more about setting variables in JavaScript, see this guide.

Want to receive approximately one email every month with new articles, tools, and references I've discovered? Sign up below.

Read past issues.

Social Links
Site References