Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS SAM Local vs Localstack

I've seen that AWS published recently AWS SAM Local for serverless applications. I find LocalStack to be very similar, I use it for running tests at the moment and can't see lot's of differences as they both support pretty much the same services. Are there any key differences between these two?

like image 853
Yuriy Yunikov Avatar asked Aug 16 '17 17:08

Yuriy Yunikov


People also ask

What is AWS Sam local?

AWS SAM Local is a CLI tool that allows you to locally test and debug your AWS Lambda functions defined by AWS Serverless Application Model (SAM) templates. Today, SAM Local supports Lambda functions written in Node. js, Java, and Python. SAM Local is available today in beta.

Is AWS Sam deprecated?

Installing AWS SAM CLI on 32-bit Windows Support for AWS SAM CLI on 32-bit Windows will soon be deprecated. If you operate on a 32-bit system, we recommend that you upgrade to a 64-bit system and follow the instructions found in Installing the AWS SAM CLI on Windows.

What is the difference between serverless and Sam?

SAM is the Serverless Application Model. It's an AWS abstraction over AWS CloudFormation that makes common serverless architectures easier to define. The Serverless Framework is an open-source project maintained by Serverless that not only makes it easier to define but also deploy serverless.

What does Sam local invoke do?

The sam local invoke command is useful for developing serverless functions that handle asynchronous events, such as Amazon Simple Storage Service (Amazon S3) or Amazon Kinesis events. It can also be useful if you want to compose a script of test cases. You can pass in the event body using the --event parameter.

Does AWS Sam work with localstack?

In the same vein, one thing that bothers most of us working with aws cloud is to test it locally. Good thing is that we have localstack to our rescue. This post will focus on how you can have AWS SAM working with Localstack. NodeJs 12.x

Should I use SAM local or Sam local For serverless testing?

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.

Can I test AWS lambdas locally without having to deploy?

Test AWS Lambdas locally without having to deploy on the cloud. 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.

How do I deploy a Sam application on localstack?

To deploy SAM applications on LocalStack you can use samlocal, a wrapper for the AWS SAM CLI. Simply use pip to install samlocal as a Python library on your machine: The samlocal command has the exact same usage as the underlying sam command.


2 Answers

SAM Local is basically just for testing your Lambda functions locally.-

No other local services are provided, so for example, if you want to test S3 bucket operations you need to connect to an existing AWS account.

like image 71
Nacho Coll Avatar answered Sep 18 '22 19:09

Nacho Coll


I believe the only the difference is now being coming from AWS itself, will be it its offerings for latest and greatest in terms of new features/services as launched by AWS's, even though being into BETA it will take some time for SAM local to catch up.

Also Localstack comes in 2 flavors - Base and Pro which is priced. So if given a choice I would start to explore SAM local now.

like image 31
Avish Saha Avatar answered Sep 16 '22 19:09

Avish Saha