@aws-cdk_aws-lambda-python-alpha.PythonLayerVersion

class PythonLayerVersion (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Lambda.Python.Alpha.PythonLayerVersion
Gogithub.com/aws/aws-cdk-go/awscdklambdapythonalpha/v2#PythonLayerVersion
Javasoftware.amazon.awscdk.services.lambda.python.alpha.PythonLayerVersion
Pythonaws_cdk.aws_lambda_python_alpha.PythonLayerVersion
TypeScript (source)@aws-cdk/aws-lambda-python-alpha ยป PythonLayerVersion

Implements IConstruct, IDependable, IResource, ILayerVersion

A lambda layer version.

Example

new python.PythonLayerVersion(this, 'MyLayer', {
  entry: '/path/to/my/layer', // point this to your library's directory
})

Initializer

new PythonLayerVersion(scope: Construct, id: string, props: PythonLayerVersionProps)

Parameters

  • scope Construct
  • id string
  • props PythonLayerVersionProps

Construct Props

NameTypeDescription
entry๐Ÿ”นstringThe path to the root directory of the lambda layer.
bundling?๐Ÿ”นBundlingOptionsBundling options to use for this function.
compatibleArchitectures?๐Ÿ”นArchitecture[]The system architectures compatible with this layer.
compatibleRuntimes?๐Ÿ”นRuntime[]The runtimes compatible with the python layer.
description?๐Ÿ”นstringThe description the this Lambda Layer.
layerVersionName?๐Ÿ”นstringThe name of the layer.
license?๐Ÿ”นstringThe SPDX licence identifier or URL to the license file for this layer.
removalPolicy?๐Ÿ”นRemovalPolicyWhether to retain this version of the layer when a new version is added or when the stack is deleted.

entry๐Ÿ”น

Type: string

The path to the root directory of the lambda layer.


bundling?๐Ÿ”น

Type: BundlingOptions (optional, default: Use the default bundling Docker image, with x86_64 architecture.)

Bundling options to use for this function.

Use this to specify custom bundling options like the bundling Docker image, asset hash type, custom hash, architecture, etc.


compatibleArchitectures?๐Ÿ”น

Type: Architecture[] (optional, default: [Architecture.X86_64])

The system architectures compatible with this layer.


compatibleRuntimes?๐Ÿ”น

Type: Runtime[] (optional, default: Only Python 3.7 is supported.)

The runtimes compatible with the python layer.


description?๐Ÿ”น

Type: string (optional, default: No description.)

The description the this Lambda Layer.


layerVersionName?๐Ÿ”น

Type: string (optional, default: A name will be generated.)

The name of the layer.


license?๐Ÿ”น

Type: string (optional, default: No license information will be recorded.)

The SPDX licence identifier or URL to the license file for this layer.


removalPolicy?๐Ÿ”น

Type: RemovalPolicy (optional, default: RemovalPolicy.DESTROY)

Whether to retain this version of the layer when a new version is added or when the stack is deleted.

Properties

NameTypeDescription
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
layerVersionArn๐Ÿ”นstringThe ARN of the Lambda Layer version that this Layer defines.
node๐Ÿ”นNodeThe tree node.
stack๐Ÿ”นStackThe stack in which this resource is defined.
compatibleRuntimes?๐Ÿ”นRuntime[]The runtimes compatible with this Layer.

env๐Ÿ”น

Type: 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.


layerVersionArn๐Ÿ”น

Type: string

The ARN of the Lambda Layer version that this Layer defines.


node๐Ÿ”น

Type: Node

The tree node.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.


compatibleRuntimes?๐Ÿ”น

Type: Runtime[] (optional)

The runtimes compatible with this Layer.

Methods

NameDescription
addPermission(id, permission)๐Ÿ”นAdd permission for this layer version to specific entities.
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
toString()๐Ÿ”นReturns a string representation of this construct.

addPermission(id, permission)๐Ÿ”น

public addPermission(id: string, permission: LayerVersionPermission): void

Parameters

  • id string
  • permission LayerVersionPermission

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.


applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

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).


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.