0

I am running a web service in Kubernetes environment. I have attached a role (custom_role) to the pod.

This role has permission to access SQS queue.

Now, how do I utilize this role while accessing the SQS? This is how the current code looks like (in a test environment).

const sqsClient = new aws.SQS({apiVersion: '2016-07-19',region: 'us-east-1',accessKeyId: XXX,secretAccessKey: YYY,params: { QueueUrl: 'Queue URL' }
 });

Now I have to change this code to use the role attached to pod. How do i do that?

I tried doing this, assuming that the SDK will automatically take the creds attached to the pod, but it did not work.

const sqsClient = new aws.SQS({apiVersion: '2016-07-19',region: 'us-east-1',params: { QueueUrl: 'Queue URL' }

I got the below error

Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1

What mistake am I making?

2
  • The error message tells you exactly what you're doing wrong and how to fix it. Did you actually read the words in it? Commented Oct 11, 2022 at 3:17
  • Yes I did. Bu as the role is attached to pod, I dont have a physical config file. I thought the SDK will automatically take the role attached to the pod, but it did not work. any guidance on fixing it? Commented Oct 13, 2022 at 5:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.