# AdotLambdaLayerJavaScriptSdkVersion

The collection of versions of the ADOT Lambda Layer for JavaScript SDK.

**Note:** These are legacy ADOT Lambda layers with an embedded collector.

Obtainable from: AdotLambdaLayerJavaScriptSdkVersion.LATEST, AdotLambdaLayerJavaScriptSdkVersion.V1_15_0_1, AdotLambdaLayerJavaScriptSdkVersion.V1_16_0, AdotLambdaLayerJavaScriptSdkVersion.V1_17_1, AdotLambdaLayerJavaScriptSdkVersion.V1_18_1, AdotLambdaLayerJavaScriptSdkVersion.V1_30_0, AdotLambdaLayerJavaScriptSdkVersion.V1_7_0

- Source: [`aws-lambda/lib/adot-layers.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-lambda/lib/adot-layers.ts#L412)
- Type last changed: v2.178.0 · 6 Feb 2025

## Example

TypeScript:

```ts
import {
  AdotLambdaExecWrapper,
  AdotLayerVersion,
  AdotLambdaLayerJavaScriptSdkVersion,
} from 'aws-cdk-lib/aws-lambda';

const fn = new lambda.Function(this, 'MyFunction', {
  runtime: lambda.Runtime.NODEJS_LATEST,
  handler: 'index.handler',
  code: lambda.Code.fromInline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'),
  adotInstrumentation: {
    layerVersion: AdotLayerVersion.fromJavaScriptSdkLayerVersion(AdotLambdaLayerJavaScriptSdkVersion.LATEST),
    execWrapper: AdotLambdaExecWrapper.REGULAR_HANDLER,
  },
});
```

Python:

```python
from aws_cdk.aws_lambda import AdotLambdaExecWrapper, AdotLayerVersion, AdotLambdaLayerJavaScriptSdkVersion

fn = lambda_.Function(self, "MyFunction",
    runtime=lambda_.Runtime.NODEJS_LATEST,
    handler="index.handler",
    code=lambda_.Code.from_inline("exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); }"),
    adot_instrumentation=lambda.AdotInstrumentationConfig(
        layer_version=AdotLayerVersion.from_java_script_sdk_layer_version(AdotLambdaLayerJavaScriptSdkVersion.LATEST),
        exec_wrapper=AdotLambdaExecWrapper.REGULAR_HANDLER
    )
)
```

Java:

```java
import software.amazon.awscdk.services.lambda.AdotLambdaExecWrapper;
import software.amazon.awscdk.services.lambda.AdotLayerVersion;
import software.amazon.awscdk.services.lambda.AdotLambdaLayerJavaScriptSdkVersion;

Function fn = Function.Builder.create(this, "MyFunction")
        .runtime(Runtime.NODEJS_LATEST)
        .handler("index.handler")
        .code(Code.fromInline("exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); }"))
        .adotInstrumentation(AdotInstrumentationConfig.builder()
                .layerVersion(AdotLayerVersion.fromJavaScriptSdkLayerVersion(AdotLambdaLayerJavaScriptSdkVersion.LATEST))
                .execWrapper(AdotLambdaExecWrapper.REGULAR_HANDLER)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.Lambda;

var fn = new Function(this, "MyFunction", new FunctionProps {
    Runtime = Runtime.NODEJS_LATEST,
    Handler = "index.handler",
    Code = Code.FromInline("exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); }"),
    AdotInstrumentation = new AdotInstrumentationConfig {
        LayerVersion = AdotLayerVersion.FromJavaScriptSdkLayerVersion(AdotLambdaLayerJavaScriptSdkVersion.LATEST),
        ExecWrapper = AdotLambdaExecWrapper.REGULAR_HANDLER
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"

fn := lambda.NewFunction(this, jsii.String("MyFunction"), &FunctionProps{
	Runtime: lambda.Runtime_NODEJS_LATEST(),
	Handler: jsii.String("index.handler"),
	Code: lambda.Code_FromInline(jsii.String("exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); }")),
	AdotInstrumentation: &AdotInstrumentationConfig{
		LayerVersion: awscdk.AdotLayerVersion_FromJavaScriptSdkLayerVersion(awscdk.AdotLambdaLayerJavaScriptSdkVersion_LATEST()),
		ExecWrapper: awscdk.AdotLambdaExecWrapper_REGULAR_HANDLER,
	},
})
```

## Properties

- `LATEST`: [AdotLambdaLayerJavaScriptSdkVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AdotLambdaLayerJavaScriptSdkVersion.html) (static) — The latest layer version available in this CDK version.

  New versions could
  introduce incompatible changes. Make sure to test them before deploying to production.

- `V1_15_0_1`: [AdotLambdaLayerJavaScriptSdkVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AdotLambdaLayerJavaScriptSdkVersion.html) (static) — Version 1.15.0.

- `V1_16_0`: [AdotLambdaLayerJavaScriptSdkVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AdotLambdaLayerJavaScriptSdkVersion.html) (static) — Version 1.16.0.

- `V1_17_1`: [AdotLambdaLayerJavaScriptSdkVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AdotLambdaLayerJavaScriptSdkVersion.html) (static) — Version 1.17.1.

- `V1_18_1`: [AdotLambdaLayerJavaScriptSdkVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AdotLambdaLayerJavaScriptSdkVersion.html) (static) — Version 1.18.1.

- `V1_30_0`: [AdotLambdaLayerJavaScriptSdkVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AdotLambdaLayerJavaScriptSdkVersion.html) (static) — Version 1.30.0.

- `V1_7_0`: [AdotLambdaLayerJavaScriptSdkVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.AdotLambdaLayerJavaScriptSdkVersion.html) (static) — Version 1.7.0.

## Methods

- `layerArn(scope: IConstruct, architecture: Architecture): string` — The ARN of the Lambda layer.

  **Parameters**

  - `scope` — The binding scope.
  - `architecture` — The architecture of the Lambda layer (either X86_64 or ARM_64).
