in nodejs10.x/author-from-scratch/cdk/cdk/lib/cdk-stack.ts [7:26]
constructor(scope: App, id: string, props: StackProps) {
super(scope, id, props);
new CfnParameter(this, 'AppId');
// The code will be uploaded to this location during the pipeline's build step
const artifactBucket = process.env.S3_BUCKET!;
const artifactKey = `${process.env.CODEBUILD_BUILD_ID}/function-code.zip`;
// This is a Lambda function config associated with the source code: hello-from-lambda.js
new lambda.Function(this, 'helloFromLambda', {
description: 'A Lambda function that returns a string.',
handler: 'src/handlers/hello-from-lambda.helloFromLambdaHandler',
runtime: lambda.Runtime.NODEJS_10_X,
code: lambda.Code.fromBucket(
s3.Bucket.fromBucketName(this, 'ArtifactBucket', artifactBucket),
artifactKey,
),
});
}