How the Secrets Manager extension in AWS Systems Manager Cloud Extensions works
The Secrets Manager extension loads secrets into an in-memory cache and checks Secrets Manager for changes after the cache time to live (TTL) expires.
-
Start – When the extension starts, it loads the secrets and the tagged secrets that you list under Prefetch. A random delay of up to Max prefetch delay seconds spreads the load across hosts.
-
Request check – When caller authentication is on, the runtime checks the SigV4 signature of each request. If the server-side request forgery (SSRF) token header check is on, the extension checks each query and path request for the token. The token must be in one of the SSRF token headers. The extension refuses requests that carry an
X-Forwarded-Forheader. -
Cached reads – The extension serves a secret from the cache until the cache TTL expires.
-
Checks after the TTL – When you request a secret after its TTL expires, the extension calls
DescribeSecret. If the cached version is still current, the extension serves the cached value again with a fresh TTL. Otherwise, the extension callsGetSecretValue. -
Cache eviction – When the cache reaches the cache size, the extension drops the secret that it fetched least recently.
Caching
-
The cache is in memory. The cache resets when the runtime restarts or the extension reloads. For example, the extension reloads on a version update.
-
The credentials of the extension and each role that you pass as
roleArnhave separate caches. Each cache has its own size limit. -
The extension doesn't include cache invalidation. If a secret rotates before its cache entry expires, the extension might return a stale secret value. To force a refresh, use
refreshNow. -
The extension returns secret values in the same format as the AWS Secrets Manager Agent. The extension doesn't encrypt secret values in the cache.
Resilience during outages
When Serve cached secrets on transient errors is on, which is the default, the extension serves an expired cached secret. This happens when a refresh fails with a timeout, a connection error, or a 5xx error. The extension doesn't retry calls to Secrets Manager. Retry in your application.