# Lambda Layer with KubeCtl v1.24 --- ![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge) --- This module exports a single class called `KubectlV24Layer` which is a `lambda.LayerVersion` that bundles the [`kubectl`](https://kubernetes.io/docs/reference/kubectl/kubectl/) and the [`helm`](https://helm.sh/) command line. > - Helm Version: 3.9.4 > - Kubectl Version: 1.24.0 > Usage: ```ts // KubectlLayer bundles the 'kubectl' and 'helm' command lines import { KubectlV24Layer } from '@aws-cdk/lambda-layer-kubectl-v24'; import * as lambda from 'aws-cdk-lib/aws-lambda'; declare const fn: lambda.Function; const kubectl = new KubectlV24Layer(this, 'KubectlLayer'); fn.addLayers(kubectl); ``` `kubectl` will be installed under `/opt/kubectl/kubectl`, and `helm` will be installed under `/opt/helm/helm`. # API Reference ## Constructs ### KubectlV24Layer A CDK Asset construct that contains `kubectl` and `helm`. #### Initializers ```typescript import { KubectlV24Layer } from '@aws-cdk/lambda-layer-kubectl-v24' new KubectlV24Layer(scope: Construct, id: string) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | scope | constructs.Construct | *No description.* | | id | string | *No description.* | --- ##### `scope`Required - *Type:* constructs.Construct --- ##### `id`Required - *Type:* string --- #### Methods | **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. | --- ##### `toString` ```typescript public toString(): string ``` Returns a string representation of this construct. ##### `applyRemovalPolicy` ```typescript 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`). ###### `policy`Required - *Type:* aws-cdk-lib.RemovalPolicy --- ##### `addPermission` ```typescript 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. ###### `id`Required - *Type:* string --- ###### `permission`Required - *Type:* aws-cdk-lib.aws_lambda.LayerVersionPermission --- #### Static Functions | **Name** | **Description** | | --- | --- | | isConstruct | Checks if `x` is a construct. | | 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. | --- ##### ~~`isConstruct`~~ ```typescript import { KubectlV24Layer } from '@aws-cdk/lambda-layer-kubectl-v24' KubectlV24Layer.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`Required - *Type:* any Any object. --- ##### `isResource` ```typescript import { KubectlV24Layer } from '@aws-cdk/lambda-layer-kubectl-v24' KubectlV24Layer.isResource(construct: IConstruct) ``` Check whether the given construct is a Resource. ###### `construct`Required - *Type:* constructs.IConstruct --- ##### `fromLayerVersionArn` ```typescript import { KubectlV24Layer } from '@aws-cdk/lambda-layer-kubectl-v24' KubectlV24Layer.fromLayerVersionArn(scope: Construct, id: string, layerVersionArn: string) ``` Imports a layer version by ARN. Assumes it is compatible with all Lambda runtimes. ###### `scope`Required - *Type:* constructs.Construct --- ###### `id`Required - *Type:* string --- ###### `layerVersionArn`Required - *Type:* string --- ##### `fromLayerVersionAttributes` ```typescript import { KubectlV24Layer } from '@aws-cdk/lambda-layer-kubectl-v24' KubectlV24Layer.fromLayerVersionAttributes(scope: Construct, id: string, attrs: LayerVersionAttributes) ``` Imports a Layer that has been defined externally. ###### `scope`Required - *Type:* constructs.Construct the parent Construct that will use the imported layer. --- ###### `id`Required - *Type:* string the id of the imported layer in the construct tree. --- ###### `attrs`Required - *Type:* aws-cdk-lib.aws_lambda.LayerVersionAttributes the properties of the imported layer. --- #### Properties | **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. | --- ##### `node`Required ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ##### `env`Required ```typescript 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. --- ##### `stack`Required ```typescript public readonly stack: Stack; ``` - *Type:* aws-cdk-lib.Stack The stack in which this resource is defined. --- ##### `layerVersionArn`Required ```typescript public readonly layerVersionArn: string; ``` - *Type:* string The ARN of the Lambda Layer version that this Layer defines. --- ##### `compatibleRuntimes`Optional ```typescript public readonly compatibleRuntimes: Runtime[]; ``` - *Type:* aws-cdk-lib.aws_lambda.Runtime[] The runtimes compatible with this Layer. ---