Skip to content

Commit 6985d0a

Browse files
committed
chore(v2): improve documentation based on feedback (aws-powertools#1092)
1 parent feb3600 commit 6985d0a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Diff for: docs/FAQs.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ Powertools uses the `url-connection-client` as the default http client. The `url
5353
With the [announcement](https://aws.amazon.com/blogs/developer/announcing-availability-of-the-aws-crt-http-client-in-the-aws-sdk-for-java-2-x/) of the `aws-crt-client` a new http client has been released, which offers faster SDK startup time and smaller memory footprint.
5454

5555
Unfortunately, replacing the `url-connection-client` dependency with the `aws-crt-client` will not immediately improve the lambda cold start performance and memory footprint,
56-
as the default version of the dependency contains low level libraries for all target runtimes (linux, macos, windows, etc).
56+
as the default version of the dependency contains low level libraries for all target runtimes (Linux, MacOS, Windows, etc).
57+
58+
### Configuring dependencies
5759

5860
Using the `aws-crt-client` in your project requires the exclusion of the `url-connection-client` transitive dependency from the powertools dependency.
5961

@@ -98,21 +100,24 @@ By specifying the specific target runtime, it will avoid other target runtimes t
98100
</dependencies>
99101
```
100102

101-
After configuring the dependencies, it's required to specify the AWS SDK http client in the code.
102-
Most modules support a custom sdk client by leveraging the `.withClient()` method on the for instance the Provider singleton:
103+
### Explicitly set the AWS CRT HTTP Client
104+
After configuring the dependencies, it's required to explicitly specify the AWS SDK http client.
105+
Depending on the Powertools module, there is a different way to configure the sdk client.
106+
107+
The following example shows how to use the Lambda Powertools Parameters module while leveraging the AWS CRT Client.
103108

104109
```java hl_lines="11-16 19-20 22"
105110
import static software.amazon.lambda.powertools.parameters.transform.Transformer.base64;
106111

107112
import com.amazonaws.services.lambda.runtime.Context;
108113
import com.amazonaws.services.lambda.runtime.RequestHandler;
109114
import software.amazon.awssdk.services.ssm.SsmClient;
115+
import software.amazon.awssdk.http.crt.AwsCrtHttpClient;
110116
import software.amazon.lambda.powertools.parameters.ssm.SSMProvider;
111117

112118
public class RequestHandlerWithParams implements RequestHandler<String, String> {
113119

114-
// Get an instance of the SSMProvider. We can provide a custom client here if we want,
115-
// for instance to use the aws crt http client.
120+
// Get an instance of the SSMProvider with a custom HTTP client (aws crt).
116121
SSMProvider ssmProvider = SSMProvider
117122
.builder()
118123
.withClient(

0 commit comments

Comments
 (0)