get AWS credentials from within ECS container to make AWS API calls

0

Hi team,

My application runs on ECS fargate.

This application uses some AWS clients for services such as S3, SES, SQS, SNS...

These services are accessed by my application through

accessKeyId and secretAccessKey credentials (for MyappIamUser), which are configured as secret environment variables on my ECS container (read from secret manager ).

My app needs to be migrated to another AWS account where I cannot create any IAM user.

How can my application running on ECS fargate get credentials to access AWS services via clients: S3, SES, SQS, SNS ...?

can I use this : https://www.npmjs.com/package/@aws-sdk/credential-providers ?

fromContainerMetadata ()

thank you.

3개 답변
3
수락된 답변

Please take a look at this document - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html

It is the recommended way using IAM roles rather than passing AWS user credentials to your containers directly

profile pictureAWS
전문가
답변함 2년 전
profile pictureAWS
전문가
Chris_G
검토됨 2년 전
0

You should consider using ECS task role instead of embedding keys as environment variables, which is not secured and hard to manage.

답변함 2년 전
0

ECS task role can be used instead of the referenced npm module as it provides benefits like credential isolation, Authorization, Audability

profile pictureAWS
전문가
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠