A single lambda
Add an import statement at the beginning of lib/cdk-workshop-stack.ts, and a lambda.Function to your stack.
import * as cdk from 'aws-cdk-lib';
import * as lambda from 'aws-cdk-lib/aws-lambda';
export class CdkWorkshopStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// defines an AWS Lambda resource
const hello = new lambda.Function(this, 'NameOfHandler', {
runtime: lambda.Runtime.NODEJS_16_X, // execution environment
code: lambda.Code.fromAsset('lambda'), // code loaded from "lambda" directory
handler: 'main.handler' // file is "main" from main.js, function is "handler"
});
}
}