Jaf
Jaf

Reputation: 921

AWS SAM Local vs Serverless-offline

We are a Terraform shop for standing up our infrastructure on AWS and I am using AWS SAM Local to:

  1. Test AWS Lambdas locally without having to deploy on the cloud.
  2. I can also run integration tests on locally running lambda function as it will call downstream services that are running in the cloud.

I am curious about serverless-offline. I don't have much experience with the npm serverless library and wondering if others have any experience how it compares to SAM Local? Does it have same capabilities that I am able to accomplish with AWS SAM Local?

Upvotes: 1

Views: 2731

Answers (1)

valdeci
valdeci

Reputation: 15237

The sam local cli command and the Serverless Offline plugin work in similar ways. Both run a Docker instance and emulate API Gateway and Lambda. Additionally, Serverless Framework supports other platforms, unlike SAM Local.

The biggest advantage of using one or another is the ability to test your Serveless functions locally with the tool that you are currently using. So if you are using AWS SAM, the sam local will be the best option, similar if you are using the Serverless Framework, as the best option will be using the Serverless-offline plugin.

Serverless Framework included offline testing long before SAM Local arrived, so maybe you can find options that are not available yet using SAM local. sam local can have some advantages, such as template validation.

Both systems use Node.js and support API Gateway and Lambda, but neither currently supports DynamoDB execution, so you need to work in a way to make your DynamoDb available locally.

If you want to decide if the best option for you is the AWS SAM or the Serveless Framework, you can take a look in comparison like this one: Comparing AWS SAM with the Serverless framework.

Upvotes: 4

Related Questions