Defines a new Lambda Layer with Powertools for AWS Lambda (Python) library.
import { LambdaPowertoolsLayer } from 'cdk-aws-lambda-powertools-layer'
new LambdaPowertoolsLayer(scope: Construct, id: string, props?: PowertoolsLayerProps)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
PowertoolsLayerProps |
No description. |
- Type: constructs.Construct
- Type: string
- Type: PowertoolsLayerProps
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
applyRemovalPolicy |
Apply the given removal policy to this resource. |
addPermission |
Add permission for this layer version to specific entities. |
public toString(): string
Returns a string representation of this construct.
public applyRemovalPolicy(policy: RemovalPolicy): void
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
- Type: aws-cdk-lib.RemovalPolicy
public addPermission(id: string, permission: LayerVersionPermission): void
Add permission for this layer version to specific entities.
Usage within
the same account where the layer is defined is always allowed and does not
require calling this method. Note that the principal that creates the
Lambda function using the layer (for example, a CloudFormation changeset
execution role) also needs to have the lambda:GetLayerVersion
permission on the layer version.
- Type: string
- Type: aws-cdk-lib.aws_lambda.LayerVersionPermission
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isOwnedResource |
Returns true if the construct was created by CDK, and false otherwise. |
isResource |
Check whether the given construct is a Resource. |
fromLayerVersionArn |
Imports a layer version by ARN. |
fromLayerVersionAttributes |
Imports a Layer that has been defined externally. |
import { LambdaPowertoolsLayer } from 'cdk-aws-lambda-powertools-layer'
LambdaPowertoolsLayer.isConstruct(x: any)
Checks if x
is a construct.
- Type: any
Any object.
import { LambdaPowertoolsLayer } from 'cdk-aws-lambda-powertools-layer'
LambdaPowertoolsLayer.isOwnedResource(construct: IConstruct)
Returns true if the construct was created by CDK, and false otherwise.
- Type: constructs.IConstruct
import { LambdaPowertoolsLayer } from 'cdk-aws-lambda-powertools-layer'
LambdaPowertoolsLayer.isResource(construct: IConstruct)
Check whether the given construct is a Resource.
- Type: constructs.IConstruct
import { LambdaPowertoolsLayer } from 'cdk-aws-lambda-powertools-layer'
LambdaPowertoolsLayer.fromLayerVersionArn(scope: Construct, id: string, layerVersionArn: string)
Imports a layer version by ARN.
Assumes it is compatible with all Lambda runtimes.
- Type: constructs.Construct
- Type: string
- Type: string
import { LambdaPowertoolsLayer } from 'cdk-aws-lambda-powertools-layer'
LambdaPowertoolsLayer.fromLayerVersionAttributes(scope: Construct, id: string, attrs: LayerVersionAttributes)
Imports a Layer that has been defined externally.
- Type: constructs.Construct
the parent Construct that will use the imported layer.
- Type: string
the id of the imported layer in the construct tree.
- Type: aws-cdk-lib.aws_lambda.LayerVersionAttributes
the properties of the imported layer.
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
env |
aws-cdk-lib.ResourceEnvironment |
The environment this resource belongs to. |
stack |
aws-cdk-lib.Stack |
The stack in which this resource is defined. |
layerVersionArn |
string |
The ARN of the Lambda Layer version that this Layer defines. |
compatibleRuntimes |
aws-cdk-lib.aws_lambda.Runtime[] |
The runtimes compatible with this Layer. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly env: ResourceEnvironment;
- Type: aws-cdk-lib.ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
public readonly stack: Stack;
- Type: aws-cdk-lib.Stack
The stack in which this resource is defined.
public readonly layerVersionArn: string;
- Type: string
The ARN of the Lambda Layer version that this Layer defines.
public readonly compatibleRuntimes: Runtime[];
- Type: aws-cdk-lib.aws_lambda.Runtime[]
The runtimes compatible with this Layer.
import { LambdaPowertoolsLayerPythonV3 } from 'cdk-aws-lambda-powertools-layer'
new LambdaPowertoolsLayerPythonV3(scope: Construct, id: string, props?: PowertoolsPythonLayerProps)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
PowertoolsPythonLayerProps |
No description. |
- Type: constructs.Construct
- Type: string
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
applyRemovalPolicy |
Apply the given removal policy to this resource. |
addPermission |
Add permission for this layer version to specific entities. |
public toString(): string
Returns a string representation of this construct.
public applyRemovalPolicy(policy: RemovalPolicy): void
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
- Type: aws-cdk-lib.RemovalPolicy
public addPermission(id: string, permission: LayerVersionPermission): void
Add permission for this layer version to specific entities.
Usage within
the same account where the layer is defined is always allowed and does not
require calling this method. Note that the principal that creates the
Lambda function using the layer (for example, a CloudFormation changeset
execution role) also needs to have the lambda:GetLayerVersion
permission on the layer version.
- Type: string
- Type: aws-cdk-lib.aws_lambda.LayerVersionPermission
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
isOwnedResource |
Returns true if the construct was created by CDK, and false otherwise. |
isResource |
Check whether the given construct is a Resource. |
fromLayerVersionArn |
Imports a layer version by ARN. |
fromLayerVersionAttributes |
Imports a Layer that has been defined externally. |
import { LambdaPowertoolsLayerPythonV3 } from 'cdk-aws-lambda-powertools-layer'
LambdaPowertoolsLayerPythonV3.isConstruct(x: any)
Checks if x
is a construct.
- Type: any
Any object.
import { LambdaPowertoolsLayerPythonV3 } from 'cdk-aws-lambda-powertools-layer'
LambdaPowertoolsLayerPythonV3.isOwnedResource(construct: IConstruct)
Returns true if the construct was created by CDK, and false otherwise.
- Type: constructs.IConstruct
import { LambdaPowertoolsLayerPythonV3 } from 'cdk-aws-lambda-powertools-layer'
LambdaPowertoolsLayerPythonV3.isResource(construct: IConstruct)
Check whether the given construct is a Resource.
- Type: constructs.IConstruct
import { LambdaPowertoolsLayerPythonV3 } from 'cdk-aws-lambda-powertools-layer'
LambdaPowertoolsLayerPythonV3.fromLayerVersionArn(scope: Construct, id: string, layerVersionArn: string)
Imports a layer version by ARN.
Assumes it is compatible with all Lambda runtimes.
- Type: constructs.Construct
- Type: string
- Type: string
import { LambdaPowertoolsLayerPythonV3 } from 'cdk-aws-lambda-powertools-layer'
LambdaPowertoolsLayerPythonV3.fromLayerVersionAttributes(scope: Construct, id: string, attrs: LayerVersionAttributes)
Imports a Layer that has been defined externally.
- Type: constructs.Construct
the parent Construct that will use the imported layer.
- Type: string
the id of the imported layer in the construct tree.
- Type: aws-cdk-lib.aws_lambda.LayerVersionAttributes
the properties of the imported layer.
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
env |
aws-cdk-lib.ResourceEnvironment |
The environment this resource belongs to. |
stack |
aws-cdk-lib.Stack |
The stack in which this resource is defined. |
layerVersionArn |
string |
The ARN of the Lambda Layer version that this Layer defines. |
compatibleRuntimes |
aws-cdk-lib.aws_lambda.Runtime[] |
The runtimes compatible with this Layer. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly env: ResourceEnvironment;
- Type: aws-cdk-lib.ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
public readonly stack: Stack;
- Type: aws-cdk-lib.Stack
The stack in which this resource is defined.
public readonly layerVersionArn: string;
- Type: string
The ARN of the Lambda Layer version that this Layer defines.
public readonly compatibleRuntimes: Runtime[];
- Type: aws-cdk-lib.aws_lambda.Runtime[]
The runtimes compatible with this Layer.
Properties for Powertools for AWS Lambda (Python) Layer.
import { PowertoolsLayerProps } from 'cdk-aws-lambda-powertools-layer'
const powertoolsLayerProps: PowertoolsLayerProps = { ... }
Name | Type | Description |
---|---|---|
compatibleArchitectures |
aws-cdk-lib.aws_lambda.Architecture[] |
The compatible architectures for the layer. |
includeExtras |
boolean |
A flag for the extras dependencies (pydantic, aws-xray-sdk, etc.) This will increase the size of the layer significantly. If you don't use parsing, ignore it. |
layerVersionName |
string |
the name of the layer, will be randomised if empty. |
runtimeFamily |
aws-cdk-lib.aws_lambda.RuntimeFamily |
the runtime of the layer. |
version |
string |
The Powertools for AWS Lambda package version from pypi repository. |
public readonly compatibleArchitectures: Architecture[];
- Type: aws-cdk-lib.aws_lambda.Architecture[]
The compatible architectures for the layer.
public readonly includeExtras: boolean;
- Type: boolean
A flag for the extras dependencies (pydantic, aws-xray-sdk, etc.) This will increase the size of the layer significantly. If you don't use parsing, ignore it.
public readonly layerVersionName: string;
- Type: string
the name of the layer, will be randomised if empty.
public readonly runtimeFamily: RuntimeFamily;
- Type: aws-cdk-lib.aws_lambda.RuntimeFamily
the runtime of the layer.
public readonly version: string;
- Type: string
The Powertools for AWS Lambda package version from pypi repository.
Defines a new Lambda Layer with Powertools for AWS Lambda (Python) library.
import { PowertoolsPythonLayerProps } from 'cdk-aws-lambda-powertools-layer'
const powertoolsPythonLayerProps: PowertoolsPythonLayerProps = { ... }
Name | Type | Description |
---|---|---|
compatibleArchitectures |
aws-cdk-lib.aws_lambda.Architecture[] |
The compatible architectures for the layer. |
includeExtras |
boolean |
A flag for the extras dependencies (pydantic, aws-xray-sdk, etc.) This will increase the size of the layer significantly. If you don't use parsing, ignore it. |
layerVersionName |
string |
the name of the layer, will be randomised if empty. |
runtimeFamily |
aws-cdk-lib.aws_lambda.RuntimeFamily |
the runtime of the layer. |
version |
string |
The Powertools for AWS Lambda package version from pypi repository. |
pythonVersion |
aws-cdk-lib.aws_lambda.Runtime |
The Python version for Powertools for AWS Lambda (Python) V3. |
public readonly compatibleArchitectures: Architecture[];
- Type: aws-cdk-lib.aws_lambda.Architecture[]
The compatible architectures for the layer.
public readonly includeExtras: boolean;
- Type: boolean
A flag for the extras dependencies (pydantic, aws-xray-sdk, etc.) This will increase the size of the layer significantly. If you don't use parsing, ignore it.
public readonly layerVersionName: string;
- Type: string
the name of the layer, will be randomised if empty.
public readonly runtimeFamily: RuntimeFamily;
- Type: aws-cdk-lib.aws_lambda.RuntimeFamily
the runtime of the layer.
public readonly version: string;
- Type: string
The Powertools for AWS Lambda package version from pypi repository.
public readonly pythonVersion: Runtime;
- Type: aws-cdk-lib.aws_lambda.Runtime
The Python version for Powertools for AWS Lambda (Python) V3.
Allowed values: Runtime.PYTHON_3_8 Runtime.PYTHON_3_9 Runtime.PYTHON_3_10 Runtime.PYTHON_3_11 Runtime.PYTHON_3_12