Skip to content

hms-dbmi/service-workbench-infrastructure-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

service-workbench-infrastructure-tools

AWS lambda functions designed to extend SWB functionality.

Lambdas

Install

This repository uses Node version 16, pnpm, and serverless.

  • Setup node version 18 using nvm and update npm. Optional

    nvm install 18
    npm install -g npm@latest
  • Install pnpm, configure shell environment, and update.

    Note: PNPM is used as the main package manager and it's referenced in some of the serverless files. If you want to change this to a different package manager, you'll have to remove all the pnpm lock files and replace references to pnpm locally. It is reccomended to not change the package manager for the individual lambda layers from NPM, as this could result in unusual behavior for package imports.

    npm install -g pnpm
    pnpm setup
    pnpm add -g pnpm

Setup

  • Update your AWS credentials for deployments.

    vi ~/.aws/config
    vi ~/.aws/credentials
    export AWS_PROFILE=<profile name>
  • Create and/or update the config file for the stage you're deploying.

    cp configs/stage.example.yml configs/stage.<stage>.yml
    vi configs/stage.<stage>.yml
  • Deploy lambda layers, if there are changes or they don't already exist.

    cd layers
    pnpm install
    pnpm sls deploy

Test & Deploy

Move into the folder for the lambda you'd like to work with. Example, cd notification/admin.

Run unit tests on new lambda handler changes.

pnpm test

Test lambda locally with serverless emulation. (See serverless invoke local documentation for more specific instructions.)

pnpm sls invoke local \
  --stage <stage> \
  --function AccountRegistrationNotification \
  --data <handler payload>

Preview serverless AWS cloudformation artifacts, using the package command. This will package the stack as it does for deployment; the package/artifacts are located in the .serverless folder.

pnpm sls package --stage <stage>

To verify serverless parameter and variable resolution, run the print command.

pnpm sls print --stage <stage>

Deploy lambdas changes.

pnpm sls deploy --stage <stage>

About

AWS lambda functions to extend SWB functionality

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •