Best Practices for Serverless Development

Let’s take a look at some Serverless best practices.

Serverless Guru
Mar 6, 2019 · 6 min read

In this article, we dive into some Serverless best practices. There are a couple of high-level sections. First, we kick off with selecting a cloud provider. Then move to select a deployment framework. We end with leveraging fully managed services. This article is not an exhaustive list of best practices, but a few high-level topics which provide the foundation to explore further.


  • Selecting a cloud provider or two

Selecting a cloud provider or two

When it comes to Serverless development, it is even more important to make sure we select the right cloud provider for the job. The primary reason the decision is important comes down to the long term maintainability and scalability of your application.

Below is an ordered list of significant cloud providers which we have experience using to build Serverless applications:

  1. Amazon Web Services (AWS)

Amazon is number one because they started this whole movement with the release of AWS Lambda back in 2014. Amazon has been the primary driver of Serverless innovation and ensuring that new services are composable and easy to automate.

Google is number two because their Serverless offerings are less mature than Amazon around FaaS (Functions as a Service) and don’t provide the same composability that we get with Amazon. However, Google has poured much energy into making their cloud platform easy to use and for new cloud developers Google has a lower bar of entry.

At Serverless Guru, we combine both Amazon and Google to get the best of both worlds. We keep our Serverless application development centered around Amazon services and leverage Google for our CI/CD (Continuous integration/Continuous delivery) pipelines. #multi-cloud

Choosing a deployment framework

Serverless development is all about bringing multiple roles such as operations and development together. Serverless development translates to the Serverless developer writing automation and application code at the same time.

At Serverless Guru, we are active users of the Serverless Framework. The Serverless Framework allows us to easily tie various AWS services together to automate entire applications through a single terminal command.

The benefits of this approach include:

  • High levels of automation

Organizing projects

How you structure your projects has always been an important factor in software development. Serverless development is no different. Let’s take a look at a basic structure for a well broken apart project.

main.js <-- Lambda entry point
services/ <-- Business Logic
helpers/ <-- Reusable functions
resources/ <-- Native CloudFormation
scripts/ <-- CI/CD scripts
serverless.yaml <-- Serverless Framework config
cloudbuild.yaml <-- Google Cloud Build CI/CD steps

Key directories:

  • src — Lambda code

Key files:

  • serverless.yaml — Connects the lambda code and AWS resources together into a deployable stack

Creating reusable templates

Code reusability is a significant part of software development. Thanks to the Serverless Framework and Amazon our infrastructure is now code. Enabling “infrastructure reusability” through the use of shared Serverless Framework templates.

Most people who use the Serverless Framework are fully aware that you can run a command like this.

$~: sls create --template aws-nodejs --path nodejs-project

However, did you know that the Serverless Framework has A LOT of other templates? Let’s get into it.

How do you leverage a template to speed up new projects?

$~: sls create --template <template> --path <project_name>


There is official template support for python 2.7 and python 3.x.

  • Python 2.7aws-python


There is official template support for NodeJS 8.x, NodeJS + TypeScript and NodeJS + ECMA Script.

  • NodeJS 8.x aws-nodejs


There is official template support for Java with Maven and Java with Gradle.

  • Java with Mavenaws-java-maven


There is official template support for Kotlin with Maven, Kotlin with Gradle, and Kotlin with Gradle + NodeJS 🤯 🤯.

  • Kotlin with Maven aws-kotlin-jvm-maven


There is official template support for Groovy, Scala, CSharp, and FSharp.

  • Groovy with Gradle aws-groovy-gradle

But, wait there's even more.

You can also easily spin up the foundation for Serverless Plugins, Alexa skills, and even your custom templates!

Custom templates allow you to create reusable Serverless Templates which you can reference via the publicly hosted URL (e.g., GitHub).

We wrote an article showing how to deploy static web applications to AWS using a custom Serverless template which makes the entire process feel way to easy.

Additional Reading:

Leveraging fully managed services

Fully managed services, give us the ability to accelerate application development while abstracting away the details which are not needed. For example, when you buy a car, you drive around without needing to know the internal workings of a combustion engine. Fully managed services are the mantra of Serverless development.

At Serverless Guru, we always look for a fully managed solution before rolling our own. To avoid “re-inventing the wheel” and to keep the focus on the product. We lower the complexity and move faster.

Below are some of the fully managed services we leverage on Amazon and Google to help clients build Serverless/Cloud Native applications.

On the Amazon front:

  • Cognito — Authentication service supporting OAuth and OpenID

On the Google front:

  • Google Cloud Build — create build triggers on GitHub/BitBucket to power the frontend and backend CI/CD pipelines

Additional Content:

What does Serverless Guru do?

Serverless Guru helps companies build scalable and cost-effective applications on the cloud. We help train companies on how to leverage IAC, serverless, and cloud-native services. We help migrate existing applications to the cloud and optimize existing applications on the cloud to be more cost-effective. We are a Serverless development partner and an AWS Consulting partner.

What did we miss?

When you leave your answer make sure to either comment below or tweet your answer to @serverlessgurux on Twitter.

Ryan Jones

Founder — Serverless Guru

LinkedIn — @ryanjonesirl

Twitter — @ryanjonesirl

Thanks for reading 😃

If you would like to learn more about Serverless Guru, please follow us on Medium, Twitter, Instagram, Facebook, or LinkedIn!

Serverless Guru

Serverless Guru can help you migrate to serverless, build serverless applications, and train your team on serverless best practices. We are a Serverless Development partner and an AWS Consulting partner.

Serverless Guru

Written by

We can help you migrate to serverless, build serverless applications, and train your team on serverless best practices.

Serverless Guru

Serverless Guru can help you migrate to serverless, build serverless applications, and train your team on serverless best practices. We are a Serverless Development partner and an AWS Consulting partner.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade