BLOG
< Back Yan Cui | Oct 07 2019

Introducing the lumigo-cli


lumigo-cli is an open source toolkit to help smooth out your serverless development workflow.

Here at Lumigo, we are big fans of serverless. And a big part of working with AWS Lambda involves using many other AWS services. For example, services such as SNS and SQS are often used to chain Lambda functions together. They are essential ingredients of an event-driven architecture, where systems are loosely coupled through events.

However, they also pose a challenge to how we test our systems and how to get fast feedback on what’s happening in the system. For a long time, I have wished there was a CLI tool to ease a number of my daily inconveniences, such as

  • Not able to see what messages are published to an SNS topic.
  • Not able to see events are flowing in a Kinesis or DynamoDB Stream.
  • Not able to switch between AWS profiles easily.
  • Not able to easily replay messages from an SQS DLQ back to the main queue.
  • Not able to easily find inactive functions in my AWS account.

Which is why I’m happy to tell you about the lumigo-cli, a collection of useful tools that makes your serverless development flow easier.

The lumigo-cli collects together a number of useful Commands to make your serverless development flow smoother.

Listing Lambda functions

The lumigo-cli lets you see all your Lambda functions, in every region, with the list-lambda command. It shows you high-level info about the functions, including when they were last modified and last used.

The list-lambda command gives you high-level info about all your Lambda functions.

If you only want to see the inactive (not invoked for more than 30 days) functions, then you can set the -i flag.

By using the -i flag you can view only those Lambdas that have been inactive for the past 30 days or more.

Analyzing Lambda costs

In a similar vein, you can also analyze and estimate the cost of your Lambda functions in all regions using the analyze-lambda-cost command.

The lumigo-cli analyze-lambda-cost command brings up the info you need to analyze and estimate costs.

Tailing events

The lumigo-cli also has a number of commands for tailing SNS, SQS, Kinesis Streams and DynamoDB Streams. Which makes it easy for you to “listen in” on the events that are flowing through your system (as both input and output of your Lambda functions).

For instance, I can tail the events from a DynamoDB Stream by running the “tail-dynamodb” command as you can see below.

This image shows how the lumigo-cli allows you to tail events from DynamoDB streams.

Replay SQS DLQ messages

It’s an operational best practice to configure a DLQ to capture SQS messages that fail persistently. However, once the issue that caused these messages to fail has been addressed, you also need a way to reprocess thoese failed messages. This is often a manual and cumbersome process. Which is why we also included a useful command to replay these DLQ’d messages back to the main queue.

Other commands and Future works

And that’s not all. We also have other commands that are useful in a number of situations:

  • The sls-remove command removes a CloudFormation stack generated by the Serverless framework, with the option to first empty any S3 buckets that are part of the stack. Users of the Serverless framework would recognize this as “why I have to manually delete the CloudFormation stack in the AWS console”.
  • The whoami and switch-profile commands allow you to see which named AWS profile you’re currently using and quickly switch between profiles.

I hope you find these commands useful in your day-to-day work. Please give lumigo-cli a try and let us know your thoughts. If you have ideas or suggestions for new commands, please let us know by raising a feature request here.

Facebook LinkedIn Email
 
Registration request was sent successfully
GET ALL THE LATEST
NEWS & OPINION