@nona-creative/aws-cdk-lambda

AWS Lambda package with CDK

Usage no npm install needed!

<script type="module">
  import nonaCreativeAwsCdkLambda from 'https://cdn.skypack.dev/@nona-creative/aws-cdk-lambda';
</script>

README

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)