You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/parameters/README.md
+173-38
Original file line number
Diff line number
Diff line change
@@ -6,19 +6,16 @@
6
6
7
7
Powertools for AWS Lambda (TypeScript) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://docs.powertools.aws.dev/lambda-typescript/latest/#features).
8
8
9
-
You can use the library in both TypeScript and JavaScript code bases.
10
-
11
-
> Also available in [Python](https://github.com/aws-powertools/powertools-lambda-python), [Java](https://github.com/aws-powertools/powertools-lambda-java), and [.NET](https://docs.powertools.aws.dev/lambda-dotnet/).
You can use the package in both TypeScript and JavaScript code bases.
10
+
11
+
-[Intro](#intro)
12
+
-[Key features](#key-features)
13
+
-[Usage](#usage)
14
+
-[SSMProvider](#ssmprovider)
15
+
-[Fetching parameters](#fetching-parameters)
16
+
-[SecretsProvider](#secretsprovider)
17
+
-[DynamoDBProvider](#dynamodbprovider)
18
+
-[AppConfigProvider](#appconfigprovider)
22
19
-[Contribute](#contribute)
23
20
-[Roadmap](#roadmap)
24
21
-[Connect](#connect)
@@ -29,55 +26,193 @@ You can use the library in both TypeScript and JavaScript code bases.
29
26
-[Credits](#credits)
30
27
-[License](#license)
31
28
32
-
## Features
29
+
## Intro
30
+
31
+
The Parameters utility provides high-level functions to retrieve one or multiple parameter values from [AWS Systems Manager Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html), [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html), [AWS AppConfig](https://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html), [Amazon DynamoDB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Introduction.html), or your own parameter store.
32
+
33
+
## Key features
34
+
35
+
* Retrieve one or multiple parameters from the underlying provider
36
+
* Cache parameter values for a given amount of time (defaults to 5 seconds)
37
+
* Transform parameter values from JSON or base64 encoded strings
38
+
* Bring Your Own Parameter Store Provider
39
+
40
+
## Usage
41
+
42
+
### SSMProvider
43
+
44
+
To get started, install the library and the corresponding AWS SDK for JavaScript v3:
Next, review the IAM permissions attached to your AWS Lambda function and make sure you allow the [actions detailed](https://docs.powertools.aws.dev/lambda-typescript/1.9.0/utilities/parameters/#iam-permissions) in the documentation of the utility.
51
+
52
+
#### Fetching parameters
53
+
54
+
You can retrieve a single parameter using the `getParameter` high-level function.
for (const [key, value] ofObject.entries(parameters)) {
103
+
console.log(`${key}: ${value}`);
104
+
}
105
+
};
106
+
```
107
+
108
+
Check the [docs](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/#fetching-parameters) for more examples, and [the advanced section](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/#advanced) for details about caching, transforms, customizing the underlying SDK, and more.
109
+
110
+
### SecretsProvider
111
+
112
+
To get started, install the library and the corresponding AWS SDK for JavaScript v3:
Next, review the IAM permissions attached to your AWS Lambda function and make sure you allow the [actions detailed](https://docs.powertools.aws.dev/lambda-typescript/1.9.0/utilities/parameters/#iam-permissions) in the documentation of the utility.
119
+
120
+
You can fetch secrets stored in Secrets Manager using the `getSecret` function:
***[Tracer](https://docs.powertools.aws.dev/lambda-typescript/latest/core/tracer/)** - Utilities to trace Lambda function handlers, and both synchronous and asynchronous functions
35
-
***[Logger](https://docs.powertools.aws.dev/lambda-typescript/latest/core/logger/)** - Structured logging made easier, and a middleware to enrich log items with key details of the Lambda context
36
-
***[Metrics](https://docs.powertools.aws.dev/lambda-typescript/latest/core/metrics/)** - Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF)
37
-
***[Parameters (beta)](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/)** - High-level functions to retrieve one or more parameters from AWS SSM, Secrets Manager, AppConfig, and DynamoDB
125
+
exportconst handler =async ():Promise<void> => {
126
+
// Retrieve a single secret
127
+
const secret =awaitgetSecret('my-secret');
128
+
console.log(secret);
129
+
};
130
+
```
131
+
132
+
Check the [docs](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/#fetching-secrets) for more examples, and [the advanced section](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/#advanced) for details about caching, transforms, customizing the underlying SDK, and more.
133
+
134
+
### DynamoDBProvider
135
+
136
+
To get started, install the library and the corresponding AWS SDK for JavaScript v3:
Next, review the IAM permissions attached to your AWS Lambda function and make sure you allow the [actions detailed](https://docs.powertools.aws.dev/lambda-typescript/1.9.0/utilities/parameters/#iam-permissions) in the documentation of the utility.
40
143
41
-
Find the complete project's [documentation here](https://docs.powertools.aws.dev/lambda-typescript).
144
+
You can retrieve a single parameter from DynamoDB using the `DynamoDBProvider.get()` method:
The Powertools for AWS Lambda (TypeScript) utilities follow a modular approach, similar to the official [AWS SDK v3 for JavaScript](https://github.com/aws/aws-sdk-js-v3).
46
-
Each TypeScript utility is installed as standalone NPM package.
for (const [key, value] ofObject.entries(values|| {})) {
172
+
// key: param-a
173
+
// value: my-value-a
174
+
console.log(`${key}: ${value}`);
175
+
}
176
+
};
52
177
```
53
178
54
-
Or refer to the installation guide of each utility:
179
+
Check the [docs](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/#fetching-secrets) for more examples, and [the advanced section](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/#advanced) for details about caching, transforms, customizing the underlying SDK, and more.
55
180
56
-
👉 [Installation guide for the **Tracer** utility](https://docs.powertools.aws.dev/lambda-typescript/latest/core/tracer#getting-started)
57
181
58
-
👉 [Installation guide for the **Logger** utility](https://docs.powertools.aws.dev/lambda-typescript/latest/core/logger#getting-started)
182
+
### AppConfigProvider
59
183
60
-
👉 [Installation guide for the **Metrics** utility](https://docs.powertools.aws.dev/lambda-typescript/latest/core/metrics#getting-started)
184
+
To get started, install the library and the corresponding AWS SDK for JavaScript v3:
61
185
62
-
👉 [Installation guide for the **Parameters** utility](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/#getting-started)
Next, review the IAM permissions attached to your AWS Lambda function and make sure you allow the [actions detailed](https://docs.powertools.aws.dev/lambda-typescript/1.9.0/utilities/parameters/#iam-permissions) in the documentation of the utility.
The [Serverless TypeScript Demo](https://github.com/aws-samples/serverless-typescript-demo) shows how to use Powertools for AWS Lambda (TypeScript).
72
-
You can find instructions on how to deploy and load test this application in the [repository](https://github.com/aws-samples/serverless-typescript-demo).
207
+
Check the [docs](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/#fetching-app-configurations) for more examples, and [the advanced section](https://docs.powertools.aws.dev/lambda-typescript/latest/utilities/parameters/#advanced) for details about caching, transforms, customizing the underlying SDK, and more.
73
208
74
209
## Contribute
75
210
76
211
If you are interested in contributing to this project, please refer to our [Contributing Guidelines](https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/CONTRIBUTING.md).
77
212
78
213
## Roadmap
79
214
80
-
The roadmap of Powertools for AWS Lambda (TypeScript) is driven by customers’ demand.
215
+
[The roadmap](https://docs.powertools.aws.dev/lambda-typescript/latest/roadmap/) of Powertools for AWS Lambda (TypeScript) is driven by customers’ demand.
81
216
Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/aws-powertools/powertools-lambda-typescript/issues), or [creating new ones](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose), in this GitHub repository.
0 commit comments