0.2.1 • Published 4 years ago

lambee v0.2.1

Weekly downloads
1
License
MIT
Repository
bitbucket
Last release
4 years ago

Lambee CLI

A tool to help developer work with AWS Lambda. The tool helps make things more:

  • Discoverable: To help you understand what code is out there and what it does.
  • Transparent: To help you understand our running systems. What are they doing? Are they working? If there are issues, what is causing them.

Getting Started

$ npm install --global lambee-cli

This program uses the following environment variables:

  • AWS_PROFILE
  • AWS_DEFAULT_REGION

List Lambda Functions

$ lambee fnlist --help
Usage: lambee fnlist [options]

Prints a list of our Lambda functions.

Options:
  -V, --version        output the version number
  --profile <profile>  The AWS profile. You can set this using environment variable AWS_PROFILE.
  --region <region>    The AWS region. You can set this using environment variable AWS_DEFAULT_REGION.
  -c, --cache          Cache results locally. Makes repeated execution much quicker on slow networks. Will not pick up changes to the functions list though.
  -v, --verbose        Prints the full object returned by AWS SDK instead of just the function name.
  -d, --debug          Enable debug logging
  -h, --help           output usage information

Print Lambda Function Logs

$ lambee fnlogs --help
Usage: lambee fnlogs [options] <functionName>

Prints nice clean logs for a Lambda function.

Options:
  -V, --version                output the version number
  -s, --startTime [startTime]  Start time eg "10 mins ago"
  -e, --endTime <endTime>      End time eg "5 mins ago"
  -l, --logLevel <logLevel>    1: All, 2: DEBUG (default), 3: INFO, 4: ERROR
  -p, --profile [profile]      The AWS profile. You can set this using environment variable AWS_PROFILE.
  -r, --region <region>        The AWS region. You can set this using environment variable AWS_DEFAULT_REGION.
  -c, --cache                  Cache results locally. Makes repeated execution much quicker on slow networks. Will not pick up changes to the logs though.
  --debug                      Enable debug logging
  -h, --help                   output usage information

To get nicely formatted logs you should write the logging statements in your functions something like this:

console.error("Description of the error", error);

console.info("Something interesting happened", details);

process.env.DEBUG_LOGGING && console.debug("Something interesting happened", details);

Open Lambda Function in AWS Console

$ lambee fnopen --help
Usage: fnopen [options] <functionName>

Opens a Lambda function in the AWS console.

Options:
  --region <region>  The AWS region. You can set this using environment variable AWS_DEFAULT_REGION.
  -h, --help         output usage information

List SSM Params

$ lambee paramlist --help
Usage: lambee paramlist [options]

Prints the names and descriptions of our params stored in AWS SSM. Typically this will be for secret config like passwords and keys. Note, this function does not give you the config values.

Options:
  -V, --version        output the version number
  --profile <profile>  The AWS profile. You can set this using environment variable AWS_PROFILE.
  --region <region>    The AWS region. You can set this using environment variable AWS_DEFAULT_REGION.
  -c, --cache          Cache results locally. Makes repeated execution much quicker on slow networks. Will not pick up changes to the functions list though.
  -v, --verbose        Prints the full object returned by AWS SDK instead of just the function name.
  -d, --debug          Enable debug logging
  -h, --help           output usage information

Release Notes

0.2.0 (17 September 2019 - David)

  • fnopen - Opens a Lambda function in the AWS console.

0.1.0 (16 September 2019 - David)

  • params - Lists the params we have stored in SSM so that we can easily find and use them in our projects.

0.0.3 (12 September 2019 - David)

  • logs - Log files are part of system transparency. We don't want to have the situation where the system breaks and we don't know what the heck made it fall over. When the system breaks we want to be able to look into the inner workings of the program and find the root cause ASAP.
  • functions list - See a list of our Lambda functions.

To Do List

  • invoke function - Ability to invoke a Lambda function from the cli.
  • describe function - See the README file for a Lambda function so that you can discover what it does.
  • print function environment variables - Query and edit a Lambda functions environment variables.