Prefetching secrets with the Secrets Manager extension in AWS Systems Manager Cloud Extensions
With prefetch, the extension loads secrets into the cache shortly after it loads. Prefetch runs in the background. You can choose secrets in two ways:
-
Explicit secrets – List secret IDs or ARNs, each with an optional
roleArn. -
Tag-based discovery – Fetch every secret that has a given tag key, each with an optional
roleArn.
The extension caches a prefetched secret by the name of the secret, for the AWSCURRENT version. A later request by ARN, or with versionId or versionStage, doesn't use the prefetched entry.
Prefetch uses the Secrets Manager BatchGetSecretValue operation. It needs secretsmanager:BatchGetSecretValue on * and secretsmanager:GetSecretValue on each secret. Tag-based discovery also needs secretsmanager:ListSecrets.
To prefetch secrets on the console
-
On the Configure extension or Edit extension page, expand Prefetch.
-
To prefetch a secret, choose Add secret. For Secret ID, enter the name or ARN of the secret. To use a role to fetch the secret, expand More settings for secret, and then enter the ARN of the role in Role ARN.
-
To prefetch every secret that has a tag key, choose Add tag filter. For Tag key, enter the tag key. To use a role to find and fetch the secrets, expand More settings for tag filter. Then enter the ARN of the role in Role ARN.
-
To remove an item, choose Remove. An item that has an empty Secret ID or Tag key shows the message "Enter a value."
-
On the Edit extension page, choose Save changes. On the Configure extension page, choose Next.
The following example settings prefetch two secrets and two tag keys:
{ "security": { "ssrfHeadersEnabled": false }, "prefetch": { "cacheBufferRatio": 0.6, "maxJitterSeconds": 5, "secrets": [ { "secretId": "arn:aws:secretsmanager:us-west-2:111122223333:secret:MySecret-AbCdEf" }, { "secretId": "cross-account-secret", "roleArn": "arn:aws:iam::444455556666:role/SecretAccessRole" } ], "filterTags": [ { "key": "Environment" }, { "key": "Team", "roleArn": "arn:aws:iam::444455556666:role/SecretAccessRole" } ] } }