Optionalconfig: NonNullable<SecretsProviderOptions>Protected_Retrieve a secret from AWS Secrets Manager.
Name of the secret or its ID
Optionaloptions: NonNullable<SecretsGetOptions>SDK options to propagate to the AWS SDK v3 for JavaScript client
Extra options to pass to the AWS SDK v3 for JavaScript client, accepts the same options as GetSecretValueCommandInput except SecretId.
Protected_Add a value to the cache.
Key of the cached value
Value to be cached
Maximum age in seconds for the value to be cached
Clear the cache.
Retrieve a secret from AWS Secrets Manager.
The name of the secret to retrieve
Optionaloptions: NonNullable<(InferredFromOptionsType & SecretsGetOptions)>Optional options to configure the provider
Optional maximum age of the value in the cache, in seconds (default: 5)
Optional flag to always fetch a new value from the store regardless if already available in cache (default: false)
Optional transform to be applied, can be json or binary
Optional additional options to pass to the AWS SDK v3 client, supports all options from GetSecretValueCommandInput except SecretId
Retrieving multiple secrets is not supported with AWS Secrets Manager.
Optional_options: unknownCheck whether a key has expired in the cache or not.
It returns true if the key is expired or not present in the cache.
Stringified representation of the key to retrieve
The Parameters utility provides a
SecretsProviderthat allows to retrieve secrets from AWS Secrets Manager.This utility supports AWS SDK v3 for JavaScript only (
@aws-sdk/client-secrets-manager). This allows the utility to be modular, and you to install only the SDK packages you need and keep your bundle size small.Basic usage
Example
If you want to retrieve secrets without customizing the provider, you can use the getSecret function instead.
Caching
By default, the provider will cache parameters retrieved in-memory for 5 seconds. You can adjust how long values should be kept in cache by using the
maxAgeparameter.Example
If instead you'd like to always ensure you fetch the latest parameter from the store regardless if already available in cache, use the
forceFetchparameter.Example
Transformations
For parameters stored in JSON or Base64 format, you can use the transform argument for deserialization.
Example
Extra SDK options
When retrieving a secret, you can pass extra options to the AWS SDK v3 for JavaScript client by using the
sdkOptionsparameter.Example
This object accepts the same options as the AWS SDK v3 for JavaScript Secrets Manager client.
Customize AWS SDK v3 for JavaScript client
By default, the provider will create a new Secrets Manager client using the default configuration.
You can customize the client by passing a custom configuration object to the provider.
Example
This object accepts the same options as the AWS SDK v3 for JavaScript Secrets Manager client.
Otherwise, if you want to use a custom client altogether, you can pass it to the provider.
Example
This object must be an instance of the AWS SDK v3 for JavaScript Secrets Manager client.
For more usage examples, see our documentation.
See
https://docs.aws.amazon.com/powertools/typescript/latest/features/parameters/