UNPKG

lambee

Version:

A tool to help developer work with AWS Lambda.

118 lines (82 loc) 4.57 kB
# 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 ```text $ npm install --global lambee-cli ``` This program uses the following environment variables: * AWS_PROFILE * AWS_DEFAULT_REGION ## List Lambda Functions ```text $ 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 ```text $ 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: ```javascript 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 ```text $ 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 ```text $ 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.