How to get access to ECS Container credentials through JS SDK? (details in thread) #3690
Unanswered
ReadyElbow
asked this question in
Q&A
Replies: 1 comment
-
Hi @ReadyElbow - thanks for reaching out and apology for not getting here sooner. I'd recommend checking out our official docs on setting credentials with Node.js and using credential provider chain. As far as connecting to S3 client, this's what you could do: import { S3Client, ListBucketsCommand } from "@aws-sdk/client-s3";
const S3_Config = {
region: "region",
credentials: {
accessKeyId: ACCESS_KEY_ID,
secretAccessKey: ACCESS_SECRET_KEY,
},
};
const s3_client = new S3Client(S3_Config);
const input = {}
const _command = new ListBucketsCommand(input);
const response = await s3_client.send(_command);
console.log(response) Hope it helps, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a Node JS application running within a ECS Container and I am looking to use the attached IAM Task Role to connect to an S3 bucket.
From what I have gathered online and through the docs, this would be automatically picked up if I were to use the S3 Client as it would use the default provider credential chain.
However, as it stands I am currently using the MinIO Client which requires specific definitions on the Access Key, Session Key, Secret Key passed to it; essentially I am trying to gain direct access to the credential values as an object.
E.g.
var s3Client = new Minio.Client({ endPoint: 's3.amazonaws.com', accessKey: fetchedCredential, secretKey: fetchedCredential, sessionToken: fetchedCredential, })
I have attempted to use the function
fromNodeProviderChain()
detailed here documentationwhich I hope will return a credential object with a list of the keys I need.
Now I have not configured this function further as the documentation is confusing e.g.
Is anyone able to help me identify what command I can run from the SDK that will give me direct access to a Credential Object using the default lookup chain?
Note: we are looking to move away from the MinIO client but we would like to start with this first issue.
Beta Was this translation helpful? Give feedback.
All reactions