Lambdasync support for adding AWS Lambda environment variables

Lambdasync 2.0 update - Environment variables in Lambda

Lambdasync is a tool to scaffold, deploy and update JSON APIs on AWS Lambda from the command line. Intro post here

AWS Lambda recently added support for environment variables.

Environment variables are perfect for storing secrets, sensitive information that you don't want to keep in your source code.

This is great news, it means you can now store sensitive information and access it through process.env.myVar in your Lambda functions.

In fact, it's such great news it prompted the first breaking change in Lambdasync.

Adding a Lambda environment variable

Previously the secret command would add a stage variable to API Gateway, that would have to be accessed through a nested object in the incoming event.

The syntax remains the same:

lambdasync secret DB_HOST=127.0.0.1

But now it adds an environment variable instead, easily accessible through process.env.DB_HOST. 🎉

Removing variables

This update also adds support for removing a variable:

lambdasync secret remove DB_HOST

Updating function config

Another little improvement is that it's now possible to change your function's timeout, memory size limit and description:

lambdasync config timeout=3  
lambdasync config memory=192  
lambdasync config description='Example project for lambdasync'  

This has already saved me from having to login to the AWS console twice. 😎