What is the difference between a Serverless Function, and a Lambda Function

Derrops picture Derrops · Apr 21, 2018 · Viewed 15.6k times · Source

I am playing around with the Cloudformation Serverless Transformation, and am trying to figure out how and when to use AWS::Serverless::Function or AWS::Lambda::Function. For some reason the Lambda version is used for SAM examples in AWS. This is very confusing. SAM github. And then there is also the servlerless framework itself which is really a nodejs framework. All this stuff is getting me extremely confused.

Answer

Ashan picture Ashan · Apr 21, 2018

First of all, let me explain each of these.

AWS Serverless Stack - A combination of AWS offered serverless technologies including API Gateway, Lambda, S3 and etc.

When Lambda was initially introduced it was challenging to develop Serverless applications using these technologies using Cloudformation. The problem was due to the complexity of writing Cloudformation for API Gateway and Lambda.

This is where Serverless Framework came in.

Serverless Framework - An Open Source DevOps framework which simplifies defining API Gateway and Lambda using a simple file called serverless.yml. Since Serverless Framework uses conventions over configurations, it required only a few lines of code to define Lambda, API Gateway and etc. Underneath Serverless Framework generates Cloudformation based on whats defined in serverless.yml. In addition, Serverless Framework supported Multiple Cloud Providers.

Later AWS introduced their own simplified scripting language called AWS SAM(Note: AWS SAM is not a Framework like Serverless with plugins and extension support as of now) to reduce the complexity in defining CloudFormation as an alternative to Serverless Framework.

AWS::Lambda::Function is the Cloudformation syntax to define a Lambda function.

AWS::Serverless::Function is the AWS SAM syntax to define a Lambda function which internally creates a Lambda function in Cloudformation (AWS::Lambda::Function) and related resources by convention when executing AWS SAM.