Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .projenrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const project = new awscdk.AwsCdkConstructLibrary({
majorVersion: 3,
name: 'cdk-aws-lambda-powertools-layer',
repositoryUrl: 'https://github.com/awslabs/cdk-aws-lambda-powertools-layer.git',
description: 'A lambda layer for AWS Powertools for python and typescript',
description: 'Powertools for AWS Lambda layer for python and typescript',
devDeps: [
'@types/prettier@2.6.0', // pin until breaking changes is resolved: https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/60310
],
Expand Down
8 changes: 4 additions & 4 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# AWS Lambda powertools layer
# Powertools for AWS Lambda Layer

## Why this project exists

This is a custom construct that will create AWS Lambda Layer with AWS Powertools for Python or NodeJS library. There are different
This is a custom construct that will create AWS Lambda Layer with Powertools for AWS Lambda for Python or NodeJS library. There are different
ways how to create a layer and when working with CDK you need to install the library, create a zip file and wire it
correctly. With this construct you don't have to care about packaging and dependency management. Create a construct
and add it to your function. The construct is an extension of the
Expand Down Expand Up @@ -49,7 +49,7 @@ pip install cdk-aws-lambda-powertools-layer

### Python

A single line will create a layer with powertools for python. For NodeJS you need to specifically set the `runtimeFamily: Runtime.NODEJS` property.
A single line will create a layer with Powertools for AWS Lambda (Python). For NodeJS you need to specifically set the `runtimeFamily: Runtime.NODEJS` property.

```python
from cdk_aws_lambda_powertools_layer import LambdaPowertoolsLayer
Expand Down
2 changes: 1 addition & 1 deletion package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/lambda-powertools-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { Architecture } from 'aws-cdk-lib/aws-lambda';
import { Construct } from 'constructs';

/**
* Properties for Powertools layer for python.
* Properties for Powertools for AWS Lambda (Python) Layer.
*/
export interface PowertoolsLayerProps {
/**
* The powertools package version from pypi repository.
* The Powertools for AWS Lambda package version from pypi repository.
*/
readonly version?: string;

Expand All @@ -35,7 +35,7 @@ export interface PowertoolsLayerProps {
}

/**
* Defines a new Lambda Layer with Powertools for python library.
* Defines a new Lambda Layer with Powertools for AWS Lambda (Python) library.
*/
export class LambdaPowertoolsLayer extends lambda.LayerVersion {
/**
Expand Down Expand Up @@ -99,7 +99,7 @@ export class LambdaPowertoolsLayer extends lambda.LayerVersion {
layerVersionName: props?.layerVersionName ? props?.layerVersionName : undefined,
license: 'MIT-0',
compatibleRuntimes: getRuntimesFromRuntimeFamily(runtimeFamily),
description: `Lambda Powertools for ${languageName} [${compatibleArchitecturesDescription}]${
description: `Powertools for AWS Lambda (${languageName}) [${compatibleArchitecturesDescription}]${
props?.includeExtras ? ' with extra dependencies' : ''
} ${props?.version ? `version ${props?.version}` : 'latest version'}`.trim(),
// Dear reader: I'm happy that you've stumbled upon this line too! You might wonder, why are we doing this and passing `undefined` when the list is empty?
Expand Down
10 changes: 5 additions & 5 deletions test/lambda-powertools-python-layer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('with no configuration the construct', () => {
const template = Template.fromStack(stack);
test('synthesizes successfully', () => {
template.hasResourceProperties('AWS::Lambda::LayerVersion', {
Description: 'Lambda Powertools for Python [x86_64] latest version',
Description: 'Powertools for AWS Lambda (Python) [x86_64] latest version',
});
});

Expand Down Expand Up @@ -41,7 +41,7 @@ describe('with arm64 architecture', () => {
const template = Template.fromStack(stack);
test('synthesizes successfully', () => {
template.hasResourceProperties('AWS::Lambda::LayerVersion', {
Description: 'Lambda Powertools for Python [arm64] latest version',
Description: 'Powertools for AWS Lambda (Python) [arm64] latest version',
CompatibleArchitectures: ['arm64'],
});
});
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('with version configuration the construct', () => {


Template.fromStack(stack).hasResourceProperties('AWS::Lambda::LayerVersion', {
Description: 'Lambda Powertools for Python [x86_64] version 1.21.0',
Description: 'Powertools for AWS Lambda (Python) [x86_64] version 1.21.0',
});
});

Expand All @@ -88,7 +88,7 @@ describe('with version configuration the construct', () => {
});

Template.fromStack(stack).hasResourceProperties('AWS::Lambda::LayerVersion', {
Description: 'Lambda Powertools for Python [x86_64] with extra dependencies version 1.22.0',
Description: 'Powertools for AWS Lambda (Python) [x86_64] with extra dependencies version 1.22.0',
});

});
Expand All @@ -100,7 +100,7 @@ describe('with version configuration the construct', () => {
});

Template.fromStack(stack).hasResourceProperties('AWS::Lambda::LayerVersion', {
Description: 'Lambda Powertools for Python [x86_64] with extra dependencies latest version',
Description: 'Powertools for AWS Lambda (Python) [x86_64] with extra dependencies latest version',
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/lambda-powertools-typescript-layer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('with minimal configuration the construct', () => {
const template = Template.fromStack(stack);
test('synthesizes successfully', () => {
template.hasResourceProperties('AWS::Lambda::LayerVersion', {
Description: 'Lambda Powertools for TypeScript [x86_64] latest version',
Description: 'Powertools for AWS Lambda (TypeScript) [x86_64] latest version',
});
});

Expand Down Expand Up @@ -58,7 +58,7 @@ describe('with version configuration the construct', () => {


Template.fromStack(stack).hasResourceProperties('AWS::Lambda::LayerVersion', {
Description: `Lambda Powertools for TypeScript [x86_64] version ${version}`,
Description: `Powertools for AWS Lambda (TypeScript) [x86_64] version ${version}`,
});
});

Expand Down