'Could not load credentials from any providers' error

0

Hello,

I'm using sdk v3 for dynamodb on node.js. When I try to dynamodb multiple times in short time, it occurs error 'CredentialsProviderError: Could not load credentials from any providers'.

I make dynamodb instance everytime if I need to access to dynamodb, like const client = new DynamoDB({ region: 'ap-northeast-2' });

I applied role to ec2, so it works well for simple access.

After I chunked the accessing dynamodb, this error disappears. So, I just can guess exchanging credentials fast makes this problem.

Could you explain about this problem?

Thanks

1개 답변
1
수락된 답변

This looks like its caused by EC2's Instance Metadata Service (IMDS) throttling.

We throttle queries to the IMDS on a per-instance basis, and we place limits on the number of simultaneous connections from an instance to the IMDS.

If you're using the IMDS to retrieve AWS security credentials, avoid querying for credentials during every transaction or concurrently from a high number of threads or processes, as this might lead to throttling. Instead, we recommend that you cache the credentials until they start approaching their expiry time.

While caching would be a good workaround, I much prefer to re-use my service clients, avoid creating them for every API call as it leads to higher latencies and unexpected issues such as IMDS throttling and increased KMS calls (if you use KMS CMK).

Ref

profile pictureAWS
전문가
답변함 일 년 전
  • I thought that credentials cache manager works behind creating new aws resource.

    then I must check credentials's expiry time to use aws resourse

    thanks!

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

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

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