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.

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ヶ月前
  • I think that execution reasoning makes sense, thanks :)

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ