Differences between SecretCache and Lambda Extension

0

In case of Java Lambdas, is there any practical benefit in using SecretCache (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets_cache-java.html) over Secrets Lambda extension via layer (https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets_lambda.html) and viceversa?

I could not find any comparison documentation, thanks.

profile picture
專家
已提問 10 個月前檢視次數 290 次
1 個回答
1
已接受的答案

Hi, I may be wrong (I didn't test in details) but I see at least one interesting difference:

  1. the Secret cache is local to your Lambda execution. So, it's useful if you make several calls to SecretManager to obtain same secret multiple time during the execution of your Lambda.
  2. The Lambda extensions can be shared across multiple executions: so, you get the benefits of caching (less cost due to less API calls, reduced latency) multiple times.

This article shows the results across multiple executions with AWS Lambda Extension for Secrets: https://www.element7.io/2022/12/boost-performance-and-reduce-costs-using-lambda-extensions/

On https://github.com/aws/aws-secretsmanager-caching-java, the recommendation is to use the Secret Cache with

private final SecretCache cache = new SecretCache();

In this form, it will go away at the end of each Lambda execution

Best, Didier

profile pictureAWS
專家
已回答 10 個月前
profile picture
專家
已審閱 1 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南