Skip to content

docs: add SSM examples to docs #3577

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 1 commit into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ You can use Powertools for AWS Lambda (TypeScript) by installing it with your fa
- !Sub arn:aws:lambda:${AWS::Region}:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:19
```

You can also use AWS SSM Parameter Store to dynamically add Powertools for AWS Lambda. The `{version}` placeholder is the semantic version number (e,g. 2.1.0) for a release or `_latest_`.

```yaml hl_lines="5"
MyLambdaFunction:
Type: AWS::Serverless::Function
Properties:
Layers:
- {{resolve:ssm:/aws/service/powertools/typescript/generic/all/{version}}}
```

If you use `esbuild` to bundle your code, make sure to exclude `@aws-lambda-powertools/*` and `@aws-sdk/*` from being bundled since the packages are already present the layer:

```yaml hl_lines="5-14"
Expand Down Expand Up @@ -195,6 +205,23 @@ You can use Powertools for AWS Lambda (TypeScript) by installing it with your fa
}
```

You can use [data sources](https://developer.hashicorp.com/terraform/language/data-sources) to resolve the SSM Parameter Store in your code, allowing you to pin to `_latest_` or a specific Powertools for AWS Lambda version.

```terraform
data "aws_ssm_parameter" "powertools_version" {
# Replace {version} with your chosen Powertools for AWS Lambda version or latest
name = "/aws/service/powertools/python/generic/all/{version}"
}

resource "aws_lambda_function" "test_lambda" {
...

runtime = "nodejs22.x"

layers = [data.aws_ssm_parameter.powertools_version.value]
}
```

=== "Pulumi"

```typescript hl_lines="11"
Expand Down