JSPM

cdk-lambda-fleet

1.4.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q43887F
  • License MIT

Deploy multiple AWS Lambda functions as docker images using AWS Cloud Development Kit

Package Exports

  • cdk-lambda-fleet

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cdk-lambda-fleet) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

AWS CDK: Lambda Fleet

MIT License cdk-lambda-fleet on NPM

Deploy multiple AWS Lambda functions as container images to Amazon ECR with CDK.

Examples

CDK Construct

When using the AWS CDK in TypeScript, you can use the published LambdaFleet construct:

$ > yarn install cdk-lambda-fleet
import * as path from "path";
import * as cdk from "@aws-cdk/core";

import { LambdaFleet } from "cdk-lambda-fleet";

export class FleetStack extends cdk.Stack {
  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    new LambdaFleet(this, "Fleet", {
      path: path.resolve(__dirname, "../src"),
    });
  }
}

Configuration

You can fork this repository and create a folder like src/lambda-python-example and store a Dockerfile there:

FROM amazon/aws-lambda-python:3.8

COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY handler.py ./

CMD [ "handler.run" ]

Using the AWS CDK, a docker image will be created and deployed to Amazon ECR for every folder in src/. After uploading the image, an AWS Lambda will be created or updated to use the latest image.

Deployment

# Deploy all functions

$ > yarn deploy

[]

Fleet.FleetLambdaNodeExampleArnXYZ = "arn:aws:lambda:eu-central-1:123:function:Fleet-FleetLambdaNodeExampleXYZ-XYZ"
Fleet.FleetLambdaPythonExampleArnXYZ = "arn:aws:lambda:eu-central-1:123:function:Fleet-FleetLambdaPythonExampleXYZ-XYZ"
Fleet.FleetLambdaTypescriptExampleArnXYZ = "arn:aws:lambda:eu-central-1:123:function:Fleet-FleetLambdaTypescriptExampleXYZ-XYZ"