Skip to content

Feature request: support providing aws sdk v3 client #1222

Closed
@dreamorosi

Description

@dreamorosi

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 the SSMProvider, 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

Metadata

Metadata

Assignees

Labels

completedThis item is complete and has been merged/shippedfeature-requestThis item refers to a feature request for an existing or new utilityparametersThis item relates to the Parameters Utility

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions