Cannot load security credentials for AWS SDK

Hi there

I’m trying to use an AWS SDK from a node.js server but I their SDK is expecting security credentials to be located in a specific directory (~/.aws/credentials for mac env for example)
Loading credentials in Node.js from the shared credentials file - AWS SDK for JavaScript . I can’t find an option for loading these variables directly with their SDKs either.

From what I can see in the Render dashboard, I can only load env variables directly to the environment or place secret files that will be located at the repo root or /etc/secrets/<filename> Neither of these options work unfortunately.

Apologies if I’m missing something obvious.

Thanks
Don

yes - I did miss something obvious. All sorted!
I got this from their java documentation regarding setting env variables directly Working with AWS Credentials - AWS SDK for Java

**Environment variables** -AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY . The AWS SDK for Java uses the [EnvironmentVariableCredentialsProvider](https://docs.aws.amazon.com/sdk-for-java/v1/reference/com/amazonaws/auth/EnvironmentVariableCredentialsProvider.html) class to load these credentials.

1 Like

Hi donoleary! I am struggling with this right now :frowning: can you please tell me how you solved this problem using EnvironmentVariableCredentialsProvider?

@Silvia_Barros From reading the article it seems like you should just be able to set
two environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY and then the SDK will use those if they are set.

As @John_B said. Once I set these Environment Variables in my Render instance, AWS picked them up without any issues

1 Like

I have no idea what I am doing wrong. When I console the env variables they are correct but for some reason they are not being picked up by aws sdk. I was able to solve the problem by creating a .json with the credentials. Thank you @John_B and @donoleary for your replies :slight_smile:

This topic was automatically closed after 11 days. New replies are no longer allowed.