import {Aws} from "@aws-cdk/core";
import {Function, LayerVersion} from "@aws-cdk/aws-lambda";
export class YourConstructClass extends core.Construct {
const thundraApiKey = <YOUR-THUNDRA-API-KEY>;
const thundraAWSAccountNo = 269863060030;
const thundraNodeLayerVersion = 96; // or any other version
const thundraLayer = LayerVersion.fromLayerVersionArn(
`arn:aws:lambda:${Aws.REGION}:${thundraAWSAccountNo}:layer:thundra-lambda-node-layer:${thundraNodeLayerVersion}`
constructor(scope: core.Construct, id: string) {
const yourFunction = new Function(<scope>, <id>, {
..., // other function properties
// Set your main handler to Thundra's handler
handler: "thundra_handler.wrapper",
..., // other environment variables
THUNDRA_APIKEY: thundraApiKey,
// Add your handler as an environment variable
// for Thundra to call as the original handler
THUNDRA_AGENT_LAMBDA_HANDLER: "<YOUR-LAMBDA-HANDLER>",