1.0.2 • Published 3 years ago

@nona-creative/aws-cdk-lambda v1.0.2

Weekly downloads
156
License
MIT
Repository
-
Last release
3 years ago

AWS Lambda (CDK)

Installation

npm i -S @nona-creative/aws-cdk-lambda

Usage

  1. Configure the build Lambda function

    const _buildLambdaFunction = buildLambdaFunction(
      Code.fromAsset(codeAssetsZipFile),
      `${this.id}-handlers`,
      `${this.id}-lambda-${this.stage}`,
    )

    optionally with VPC:

    const functionProps = {
      vpc: this.vpcStack.vpc,
      securityGroup: this.vpcStack.securityGroups[LAMBDA_VPC_SECURITY_GROUP_NAME],
      vpcSubnets: { subnetType: SubnetType.PRIVATE },
    }
    const _buildLambdaFunction = buildLambdaFunction(
      Code.fromAsset(codeAssetsZipFile),
      `${this.id}-handlers`,
      `${this.id}-lambda-${this.stage}`,
      functionProps,
    )
  2. Build functions as needed, eg.

    const getBooksLambda = _buildLambdaFunction(stack, 'getBooks', environment)
    const createBookLambda = _buildLambdaFunction(stack, 'createBook', environment)