Top serverless plugins we are using
Hoang Le
Posted on November 6, 2019
This post is originally published on our blog.
We are using the Serverless framework for a couple of years and building a lot of applications. So I wanted to summarize and provide a brief description of some plugins that our team is using every day. I am not sure it is good for you, if you have any recommendations, just let us know.
If you haven't yet checked out this list of Serverless Framework plugins, you're missing out. Or you can read this post for a short version.
Don't Reinvent The Wheel
Don't build it again if someone else already built it and open-sourced it for you.". It’s free to use and the community support that revolves around building, fixing, and maintenance.
I believe this is the most popular plugin, almost Serverless developers have used it at least one time. This Serverless plugin emulates the AWS Lambda function and API Gateway on your local machine to speed up your development cycles.
Along with using serverless-offline, our team also use some plugins that support emulate cloud services on our local machine such as:
serverless-webpack and serverless-plugin-typescript
It is easy to get started with zero-config by using serverless-plugin-typescript plugin for small projects. But large scale projects, we are using the serverless-webpack plugin that allows us defining our webpack configuration for bundling TypeScript code.
If you are using paths configuration in the tsconfig.json file, then you might need to use tsconfig-paths-webpack-plugin plugin to automatically load modules based on the location specified in the paths config
serverless-iam-roles-per-function
This plugin allows us to define the IAM roles per functions instead of using a single IAM role for all Lambda functions. Yan Cui has listed this plugin as 2nd serverless best practice on this post
We use this plugin to create custom domains for API Gateway.
serverless-plugin-split-stacks
To avoid reaching out the 200 resources limit our CloudFormation error, we use this plugin to split the main stack into multiple stacks.
How to reduce cost starts for Lambda functions? The question that a lot of developers are asking and try to reduce cost start. There are more solutions but one of them is using this plugin. It solved the cost starts by using a scheduled task that will invoke selected functions in a configurable interval (default is 5 mins, but we almost use 45 mins as the average interval that the Lambda function keep-alive)
We use this plugin to define CloudWatch alarms for Lambda functions by using default definitions or add log metric filters to log groups.
Store some environment variables that we can commit to source control and share across teams. But for storing sensitive information, we use @middy/ssm middleware to fetch SSM parameters.
If you want to run your Lambda functions under your private VPC and want to define new VPC when deploying serverless, then use this plugin. You also can use serverless-vpc-discovery plugin to retrieve an existing VPC from your AWS account.
Use this plugin to manage MYSQL connections at scale.
serverless-apigateway-service-proxy
If you want to expose API for SNS, SQS, S3, and Kinesis Streams, then you can use this plugin without Lambda, also AWS resources will be created by that plugin.
And a few more as below:
serverless-plugin-canary-deployments this plugin supports Blue/green deployment for your Lambda.
serverless-pseudo-parameters this plugin allows using CloudFormation Pseudo Parameters in your serverless.yml
serverless-s3-deploy use this plugin to sync your directory to a S3 bucket, we have used it for deploying our static website.
serverless-api-stage support defining stage variables, logging configuration (for AWS provider)
serverless-aws-alias this plugin enables use of AWS aliases on Lambda functions, for an example you can use this plugin to deploy multiple environments for different VCS branches.
serverless-s3-remover you cannot delete an S3 bucket with data, right? This plugin will solve that problem. It will prompt you to remove its data before removing Cloud Formation stack.
serverless-ses-template if you are using SES Template, right now AWS doesn't provide UI to upload or edit templates on the Console Management, you can only use API to upload template. This plugin will do that for you, it automatically creating, updating and removing AWS SES Templates using a configuration and keeps your AWS SES Templates synced with your configuration file.
Posted on November 6, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.