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
エキスパート
回答済み 1年前
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ヶ月前

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

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

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

関連するコンテンツ