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.

已提問 1 年前檢視次數 855 次
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 個月前

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

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

回答問題指南