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
ESPECIALISTA
feita há 10 meses290 visualizações
1 Resposta
1
Resposta aceita

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
ESPECIALISTA
respondido há 10 meses
profile picture
ESPECIALISTA
avaliado há um mês
  • I think that execution reasoning makes sense, thanks :)

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas