Skip to content

Files

Latest commit

9addb26 · Dec 1, 2021

History

History
70 lines (57 loc) · 1.49 KB

README.md

File metadata and controls

70 lines (57 loc) · 1.49 KB

Lambda Container Service

Service template using container based lambda function

Setup

  1. Create ECR Repo
  2. Add folloeing permissions to Repo which allows Lambda to fetch image.
{
    "Sid": "LambdaECRImageRetrievalPolicy",
    "Effect": "Allow",
    "Principal": {
        "Service": "lambda.amazonaws.com"
    },
    "Action": [
        "ecr:BatchGetImage",
        "ecr:GetDownloadUrlForLayer"
    ]
} 
  1. Change the Repo Name in
    1. publish.sh:3 (Line 3)
    2. .github/workflows/release.yml (Line 40; To update login credentials)

Developing

Runs a custom dev webserver which hosts the lambda function which can be hosted on

$ npm start

Test

Unit Tests

$ npm run test

Integration Tests

Automated Integration Tests (WIP)

Runs service using dev-server and tests using Newman test collection.

$ npm run test:newman

Manual Test

Start the environment

$ npm run build
$ docker-compose build
$ docker-compose up

In another temrinal, run:

$ curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'

Package @todo

  • Check if container repository exists (Creates if not exists) - Should be in pipeline helpers
  • npm run build
  • npm run package
  • create a release tag on Github Repo
  • publish image based on version specified by semantic release.

Deploy @todo

  • Deploy a version to service's lambda by updating the image to release build version.
  • And verify health check.