-
Notifications
You must be signed in to change notification settings - Fork 168
docs: add getting started section #3818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
56d1ea3
improv(docs): add getting started sections
dreamorosi dc7399e
docs: add getting started
dreamorosi b670230
docs: add intro & getting started
dreamorosi f025735
chore: address feedback
dreamorosi 67c927b
Merge branch 'main' into docs/getting_started
am29d 81f3c5f
Merge branch 'main' into docs/getting_started
dreamorosi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
title: Environment Variables | ||
description: Environment Variables for Powertools for AWS Lambda | ||
--- | ||
|
||
<!-- markdownlint-disable MD043 --> | ||
|
||
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. | ||
|
||
???+ info | ||
Explicit parameters in your code take precedence over environment variables | ||
|
||
| Environment variable | Description | Utility | Default | | ||
| -------------------------------------------- |------------------------------------------------------------------------------------------| -------------------------------------- |------------------------------------------------| | ||
| **POWERTOOLS_SERVICE_NAME** | Set service name used for tracing namespace, metrics dimension and structured logging | All | `service_undefined` | | ||
| **POWERTOOLS_METRICS_NAMESPACE** | Set namespace used for metrics | [Metrics](features/metrics.md) | `default_namespace` | | ||
| **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) | | ||
| **POWERTOOLS_METRICS_ENABLED** | Explicitly disables emitting metrics to stdout | [Metrics](features/metrics.md) | `true` | | ||
| **POWERTOOLS_TRACE_ENABLED** | Explicitly disables tracing | [Tracer](features/tracer.md) | `true` | | ||
| **POWERTOOLS_TRACER_CAPTURE_RESPONSE** | Capture Lambda or method return as metadata. | [Tracer](features/tracer.md) | `true` | | ||
| **POWERTOOLS_TRACER_CAPTURE_ERROR** | Capture Lambda or method exception as metadata. | [Tracer](features/tracer.md) | `true` | | ||
| **POWERTOOLS_TRACER_CAPTURE_HTTPS_REQUESTS** | Capture HTTP(s) requests as segments. | [Tracer](features/tracer.md) | `true` | | ||
| **POWERTOOLS_LOGGER_LOG_EVENT** | Log incoming event | [Logger](features/logger.md) | `false` | | ||
| **POWERTOOLS_LOGGER_SAMPLE_RATE** | Debug log sampling | [Logger](features/logger.md) | `0` | | ||
| **POWERTOOLS_DEV** | Pretty-print logs, disable metrics flushing, and disable traces - use for dev only | See section below | `false` | | ||
| **POWERTOOLS_LOG_LEVEL** | Sets how verbose Logger should be, from the most verbose to the least verbose (no logs) | [Logger](features/logger.md) | `INFO` | | ||
| **POWERTOOLS_PARAMETERS_MAX_AGE** | Adjust how long values are kept in cache (in seconds) | [Parameters](features/parameters.md) | `5` | | ||
| **POWERTOOLS_PARAMETERS_SSM_DECRYPT** | Set whether to decrypt or not values retrieved from AWS Systems Manager Parameters Store | [Parameters](features/parameters.md) | `false` | | ||
| **POWERTOOLS_IDEMPOTENCY_DISABLED** | Disable the Idempotency logic without changing your code, useful for testing | [Idempotency](features/idempotency.md) | `false` | | ||
|
||
Each Utility page provides information on example values and allowed values. | ||
|
||
## Dev Mode | ||
|
||
Whether you're prototyping locally or against a non-production environment, you can use `POWERTOOLS_DEV` to increase verbosity across multiple utilities. | ||
|
||
When `POWERTOOLS_DEV` is set to a truthy value (`1`, `true`), it'll have the following effects: | ||
|
||
| Utility | Effect | | ||
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| **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 | | ||
| **Tracer** | Disables tracing operations in non-Lambda environments. This already happens automatically in the Tracer utility | | ||
| **Metrics** | Disables emitting metrics to stdout. Can be overridden by setting `POWERTOOLS_METRICS_ENABLED` to `true` | |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
title: Features | ||
description: Features of Powertools for AWS Lambda | ||
--- | ||
|
||
<!-- markdownlint-disable MD043 --> | ||
|
||
<div class="grid cards" markdown> | ||
|
||
- __Tracer__ | ||
|
||
--- | ||
|
||
Instrument your code with minimal effort. Capture traces and metadata to understand the performance of your Lambda functions. | ||
|
||
[:octicons-arrow-right-24: Read more](./tracer.md) | ||
|
||
- __Logger__ | ||
|
||
--- | ||
|
||
JSON Structured logging made easier, key management, buffering, and Middy.js middleware to enrich structured logging with key Lambda context details. | ||
|
||
[:octicons-arrow-right-24: Read more](./logger.md) | ||
|
||
- __Metrics__ | ||
|
||
--- | ||
|
||
Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF) | ||
|
||
[:octicons-arrow-right-24: Read more](./metrics.md) | ||
|
||
- __Parameters__ | ||
|
||
--- | ||
|
||
High-level functions to retrieve one or more parameters from AWS SSM Parameter Store, AWS Secrets Manager, AWS AppConfig, and Amazon DynamoDB | ||
|
||
[:octicons-arrow-right-24: Read more](./parameters.md) | ||
|
||
- __Idempotency__ | ||
|
||
--- | ||
|
||
Class method decorator, Middy middleware, and function wrapper to make your Lambda functions idempotent and prevent duplicate execution based on payload content. | ||
|
||
[:octicons-arrow-right-24: Read more](./idempotency.md) | ||
|
||
- __Batch Processing__ | ||
|
||
--- | ||
|
||
Simplify the processing of batches of events with built-in support for SQS and DynamoDB Streams. | ||
|
||
[:octicons-arrow-right-24: Read more](./batch.md) | ||
|
||
- __JMESPath Functions__ | ||
|
||
--- | ||
|
||
Built-in JMESPath functions to easily deserialize common encoded JSON payloads in Lambda functions. | ||
|
||
[:octicons-arrow-right-24: Read more](./jmespath.md) | ||
|
||
- __Parser__ | ||
|
||
--- | ||
|
||
Utility to parse and validate AWS Lambda event payloads using Zod, a TypeScript-first schema declaration and validation library. | ||
|
||
[:octicons-arrow-right-24: Read more](./parser.md) | ||
|
||
- __Validation__ | ||
|
||
--- | ||
|
||
JSON Schema validation for events and responses, including JMESPath support to unwrap events before validation. | ||
|
||
[:octicons-arrow-right-24: Read more](./validation.md) | ||
|
||
</div> |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: Installation | ||
description: Installing Powertools for AWS Lambda | ||
--- | ||
|
||
<!-- markdownlint-disable MD043 --> | ||
|
||
You can use Powertools for AWS Lambda (TypeScript) by installing it with your favorite dependency management, or via [Lambda Layers](./lambda-layers.md). | ||
|
||
The toolkit is compatible with both TypeScript and JavaScript code bases, and supports both CommonJS and ES modules. | ||
|
||
All features are available as individual packages, so you can install only the ones you need, for example: | ||
|
||
* **Logger**: `npm i @aws-lambda-powertools/logger`{.copyMe}:clipboard: | ||
* **Metrics**: `npm i @aws-lambda-powertools/metrics`{.copyMe}:clipboard: | ||
* **Tracer**: `npm i @aws-lambda-powertools/tracer`{.copyMe}:clipboard: | ||
|
||
See the [Features](../features/index.md) page for a complete list of available utilities. | ||
|
||
### Extra dependencies | ||
|
||
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. | ||
dreamorosi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
| Feature | Install | Default dependency | | ||
| -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------------- | | ||
| **[Tracer](../features/tracer.md)** | **`npm i @aws-lambda-powertools/tracer`**{.copyMe}:clipboard: | `aws-xray-sdk-core` | | ||
| **[Idempotency](../features/idempotency.md)** | **`npm i @aws-lambda-powertools/idempotency @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb`**{.copyMe}:clipboard: | | | ||
| **[Parameters (SSM)](../features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-ssm`**{.copyMe}:clipboard: | | | ||
| **[Parameters (Secrets Manager)](../features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-secrets-manager`**{.copyMe}:clipboard: | | | ||
| **[Parameters (AppConfig)](../features/parameters.md)** | **`npm i @aws-lambda-powertools/parameters @aws-sdk/client-appconfigdata`**{.copyMe}:clipboard: | | | ||
| **[Parser](../features/parser.md)** | **`npm i @aws-lambda-powertools/parser zod@~3`**{.copyMe}:clipboard: | | | ||
dreamorosi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| **[Validation](../features/validation.md)** | **`npm i @aws-lambda-powertools/validation`**{.copyMe}:clipboard: | `ajv` | |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.