Home

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:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY

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.

Let's Connect

Keep Reading

WTF is an Environment Variable?

Introductory information on environment variables and how to set them.

Aug 16, 2021

WTF is JavaScript?

A brief description of JavaScript, with a few links to dig in and learn more.

Jun 29, 2020

How to Set Environment Variables in JavaScript Projects

Environment variables are a great way to store values that will change based on your program's context.

Aug 18, 2021