AWS Parameters and Secrets Lambda Extension behaviour

0

When retrieving secrets using the AWS Parameters and Secrets Lambda Extension, does the cache get invalidated when a secret is rotated?

I can't find a concrete answer in the AWS documentation.

2개 답변
4

Lambda Extensions for Parameter Store and Secrets Manager does not automatically invalidate the cache when a secret is rotated. The extension caches secrets and parameters for the lifetime of the Lambda function container , which is reused across multiple invocations. The cache expiration is tied to the container's lifecycle rather than the secret's lifecycle.

If you need to ensure that your Lambda function retrieves the updated secrets immediately after a rotation, you have a couple of options:

  • Use versioning in your secret names or parameter names, and update your Lambda function code to use the new version when a rotation occurs. This way, the Lambda function will fetch the new version of the secret, bypassing the cached value.
  • Trigger a cold start of your Lambda function by increasing the number of concurrent executions or updating the function configuration. This will cause new containers to be created, and the cache will be invalidated in the new containers. However, this approach might have an impact on your function's performance due to the additional overhead of creating new containers.
profile picture
전문가
답변함 일 년 전
0

Hello Sedat,

If the value is retained only till the lifetime of the container's lifecycle what is the purpose of SECRETS_MANAGER_TTL environment variable in the cache?

답변함 8달 전

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

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

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

관련 콘텐츠