Closed
Description
Use case
The upcoming Parameters utility should allow customers to pass their own AWS SDK v3 client to a given provider.
This is useful for those cases in which a client is already available, for tracing the requests made by the client, or for testing (injection).
The feature is supported by the Python's version and already present in the documentation, however the implementation was left out initially.
Solution/User Experience
Note
The example below shows theSSMProvider
, but the feature should be supported by all other providers that use clients
import { SSMProvider } from '@aws-lambda-powertools/parameters/ssm';
import { SSMClient } from '@aws-sdk/client-ssm';
// construct your clients with any custom configuration
const ssmClient = new SSMClient({ region: 'us-east-1' });
// pass the client to the provider
const parametersProvider = new SSMProvider({ awsSdkV3Client: ssmClient });
export const handler = async (): Promise<void> => {
// Retrieve a single parameter
const parameter = await parametersProvider.get('/my/parameter');
console.log(parameter);
};
Alternative solutions
N/A
Acknowledgment
- This feature request meets Lambda Powertools Tenets
- Should this be considered in other Lambda Powertools languages? i.e. Python, Java