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?

Ken White
  • 123,280
  • 14
  • 225
  • 444
Secure Blob
  • 45
  • 1
  • 5
  • The error message tells you exactly what you're doing wrong and how to fix it. Did you actually read the words in it? – Ken White Oct 11 '22 at 03: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? – Secure Blob Oct 13 '22 at 05:41

0 Answers0