Skip to content

Commit dc7399e

Browse files
committed
docs: add getting started
1 parent 56d1ea3 commit dc7399e

File tree

8 files changed

+412
-365
lines changed

8 files changed

+412
-365
lines changed

docs/environment-variables.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Environment Variables
3+
description: Environment Variables for Powertools for AWS Lambda
4+
---
5+
6+
<!-- markdownlint-disable MD043 -->
7+
8+
You can configure Powertools for AWS Lambda using environment variables. This is useful when you want to set configuration values in your Infrastructure as Code (IaC) templates or when you want to override default values without changing your code.
9+
10+
???+ info
11+
Explicit parameters in your code take precedence over environment variables
12+
13+
| Environment variable | Description | Utility | Default |
14+
| -------------------------------------------- |------------------------------------------------------------------------------------------| -------------------------------------- |------------------------------------------------|
15+
| **POWERTOOLS_SERVICE_NAME** | Set service name used for tracing namespace, metrics dimension and structured logging | All | `service_undefined` |
16+
| **POWERTOOLS_METRICS_NAMESPACE** | Set namespace used for metrics | [Metrics](features/metrics.md) | `default_namespace` |
17+
| **POWERTOOLS_METRICS_FUNCTION_NAME** | Function name used as dimension for the `ColdStart` metric | [Metrics](features/metrics.md) | [See docs](features/metrics.md#setting-function-name) |
18+
| **POWERTOOLS_METRICS_ENABLED** | Explicitly disables emitting metrics to stdout | [Metrics](features/metrics.md) | `true` |
19+
| **POWERTOOLS_TRACE_ENABLED** | Explicitly disables tracing | [Tracer](features/tracer.md) | `true` |
20+
| **POWERTOOLS_TRACER_CAPTURE_RESPONSE** | Capture Lambda or method return as metadata. | [Tracer](features/tracer.md) | `true` |
21+
| **POWERTOOLS_TRACER_CAPTURE_ERROR** | Capture Lambda or method exception as metadata. | [Tracer](features/tracer.md) | `true` |
22+
| **POWERTOOLS_TRACER_CAPTURE_HTTPS_REQUESTS** | Capture HTTP(s) requests as segments. | [Tracer](features/tracer.md) | `true` |
23+
| **POWERTOOLS_LOGGER_LOG_EVENT** | Log incoming event | [Logger](features/logger.md) | `false` |
24+
| **POWERTOOLS_LOGGER_SAMPLE_RATE** | Debug log sampling | [Logger](features/logger.md) | `0` |
25+
| **POWERTOOLS_DEV** | Pretty-print logs, disable metrics flushing, and disable traces - use for dev only | See section below | `false` |
26+
| **POWERTOOLS_LOG_LEVEL** | Sets how verbose Logger should be, from the most verbose to the least verbose (no logs) | [Logger](features/logger.md) | `INFO` |
27+
| **POWERTOOLS_PARAMETERS_MAX_AGE** | Adjust how long values are kept in cache (in seconds) | [Parameters](features/parameters.md) | `5` |
28+
| **POWERTOOLS_PARAMETERS_SSM_DECRYPT** | Set whether to decrypt or not values retrieved from AWS Systems Manager Parameters Store | [Parameters](features/parameters.md) | `false` |
29+
| **POWERTOOLS_IDEMPOTENCY_DISABLED** | Disable the Idempotency logic without changing your code, useful for testing | [Idempotency](features/idempotency.md) | `false` |
30+
31+
Each Utility page provides information on example values and allowed values.
32+
33+
## Dev Mode
34+
35+
Whether you're prototyping locally or against a non-production environment, you can use `POWERTOOLS_DEV` to increase verbosity across multiple utilities.
36+
37+
When `POWERTOOLS_DEV` is set to a truthy value (`1`, `true`), it'll have the following effects:
38+
39+
| Utility | Effect |
40+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
41+
| **Logger** | Increase JSON indentation to 4 and uses global `console` to emit logs to ease testing and local debugging when running functions locally. However, Amazon CloudWatch Logs view will degrade as each new line is treated as a new message |
42+
| **Tracer** | Disables tracing operations in non-Lambda environments. This already happens automatically in the Tracer utility |
43+
| **Metrics** | Disables emitting metrics to stdout. Can be overridden by setting `POWERTOOLS_METRICS_ENABLED` to `true` |

docs/features/event-handler/api-gateway.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Event handler for Amazon API Gateway REST and HTTP APIs, Application Loader Bala
1313

1414
* Lightweight routing to reduce boilerplate for API Gateway REST/HTTP API, ALB and Lambda Function URLs.
1515
* Support for CORS, binary and Gzip compression, Decimals JSON encoding and bring your own JSON serializer
16-
* Built-in integration with [Parser](../../utilities/parser.md){target="_blank"} for easy payload validation and parsing
16+
* Built-in integration with [Parser](../../features/parser.md){target="_blank"} for easy payload validation and parsing
1717
* Works with micro function (one or a few routes) and monolithic functions (all routes)
1818

1919
## Getting started

docs/features/logger.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ These settings will be used across all logs emitted:
5656
???+ info
5757
When `POWERTOOLS_DEV` environment variable is present and set to `"true"` or `"1"`, Logger will pretty-print log messages for easier readability. We recommend to use this setting only when debugging on local environments.
5858

59-
See all environment variables in the [Environment variables](../index.md#environment-variables) section.
59+
See all environment variables in the [Environment variables](../environment-variables.md) section.
60+
6061
Check API docs to learn more about [Logger constructor options](https://docs.powertools.aws.dev/lambda/typescript/latest/api/types/_aws_lambda_powertools_logger.types.ConstructorOptions.html){target="_blank"}.
6162

6263
#### Example using AWS Serverless Application Model (SAM)

docs/getting-started/installation.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,28 @@ description: Installing Powertools for AWS Lambda
55

66
<!-- markdownlint-disable MD043 -->
77

8-
Stuff
8+
You can use Powertools for AWS Lambda (TypeScript) by installing it with your favorite dependency management, or via [Lambda Layers](lambda-layers.md).
9+
10+
The toolkit is compatible with both TypeScript and JavaScript code bases, and supports both CommonJS and ES modules.
11+
12+
All features are available as individual packages, so you can install only the ones you need, for example:
13+
14+
* **Logger**: `npm i @aws-lambda-powertools/logger`{.copyMe}:clipboard:
15+
* **Metrics**: `npm i @aws-lambda-powertools/metrics`{.copyMe}:clipboard:
16+
* **Tracer**: `npm i @aws-lambda-powertools/tracer`{.copyMe}:clipboard:
17+
18+
See the [Features](../features/index.md) page for a complete list of available utilities.
19+
20+
### Extra dependencies
21+
22+
Some features use additional dependencies like the AWS SDK for JavaScript v3, which might you need to install separately. Below is a list of utilities that use external dependencies, and the packages you need to install to use them.
23+
24+
| Feature | Install | Default dependency |
25+
| -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------- |
26+
| **[Tracer](./features/tracer.md)** | **`npm i @aws-lambda-powertools/tracer`**{.copyMe}:clipboard: | `aws-xray-sdk-core` |
27+
| **[Idempotency](./features/idempotency.md)** | **`npm i @aws-lambda-powertools/idempotency @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb`**{.copyMe}:clipboard: | |
28+
| **[Parameters (SSM)](./features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-ssm`**{.copyMe}:clipboard: | |
29+
| **[Parameters (Secrets Manager)](./features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-secrets-manager`**{.copyMe}:clipboard: | |
30+
| **[Parameters (AppConfig)](./features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-appconfigdata`**{.copyMe}:clipboard: | |
31+
| **[Parser](./features/parser.md)** | **`npm i @aws-lambda-powertools/parser zod@~3`**{.copyMe}:clipboard: | |
32+
| **[Validation](./features/validation.md)** | **`npm i @aws-lambda-powertools/validation`**{.copyMe}:clipboard: | `ajv` |

0 commit comments

Comments
 (0)