10

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?

pzrq
  • 1,626
  • 1
  • 18
  • 24
yyunikov
  • 5,719
  • 2
  • 43
  • 78

3 Answers3

10

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.

Nacho Coll
  • 523
  • 9
  • 10
4

LocalStack lets you mock AWS services, like having a fake S3 bucket

SAM Local lets you run real AWS serverless services locally, like Lambda

So, if you're writing a Lambda and want to test/debug it locally, run it in SAM Local, calling other mocked services on LocalStack

For example, your "real" Lambda calls S3 and Dynamo, then you would mock S3 and Dynamo

If you want to test a Bash script that calls a bunch of different AWS services, then use LocalStack to mock all the services (including say a mock Lambda)

Neil McGuigan
  • 46,580
  • 12
  • 123
  • 152
3

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.

Avish Saha
  • 77
  • 4