Skip to content

Add Reusable Lambda CDK construct#248

Open
pjdavis-aws wants to merge 5 commits intoaws-samples:mainfrom
pjdavis-aws:main
Open

Add Reusable Lambda CDK construct#248
pjdavis-aws wants to merge 5 commits intoaws-samples:mainfrom
pjdavis-aws:main

Conversation

@pjdavis-aws
Copy link

Issue #, if available: #247

Description of changes:
Adds a new tool snippet demonstrating a reusable CDK Construct (StandardLambda) that provides a standardized blueprint for creating Python Lambda functions.

The construct includes:

  • Dedicated CloudWatch Log Group with configurable retention and write permissions
  • AWS Lambda Powertools for Python V3 layer, auto-matched to runtime and architecture
  • X-Ray active tracing
  • Automatic dependency bundling via Docker when a requirements.txt is detected
  • Per-function overrides for runtime, architecture, memory, timeout, layers, and environment variables (merged, not replaced)

The snippet also includes a CDK stack (cdk_stack.py) with three usage examples: a minimal function, a function with overridden defaults, and a function with external dependencies, additional layers, and custom IAM permissions.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Collaborator

@bfreiberg bfreiberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, two minor comments.

pjdavis-aws and others added 2 commits March 9, 2026 08:14
Co-authored-by: Ben <9841563+bfreiberg@users.noreply.github.com>
Co-authored-by: Ben <9841563+bfreiberg@users.noreply.github.com>
Copy link
Collaborator

@bfreiberg bfreiberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for your contribution. Your snippet will be merged to Serverlessland soon

@pjdavis-aws pjdavis-aws marked this pull request as draft March 9, 2026 13:37
@pjdavis-aws pjdavis-aws marked this pull request as ready for review March 9, 2026 13:40
@pjdavis-aws pjdavis-aws changed the title Add Apache-2.0 license headers to all source files Add Reusable Lambda CDK construct Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants