What is the difference between a Serverless Function, and a Lambda Function
Framework wise there is not much difference between both however, there are minor difference technically as below
Serverless: It creates the IAM role, S3 Bucket, Cloudformation Template, create, update & deploy the code. Can Invoke the program from command.
One more important point, when we would like to delete the function and all associated services like S3, IAM role etc, that can be done using a single line command. In AWS Lambda, we need to manually remove each service one by one
AWS Lambda: It allows snippets of code to execute in response to triggers caused by activity from other AWS resources such as an AWS CloudWatch alarm, changes in a NoSQL table as DynamoDB, an upload event in an S3 bucket, etc.
AWS Lambda function has limits and it is recommended that you keep code size down and break up bigger function to smaller ones.
AWS::Serverless::Function
is for when it is used with AWS SAM, whereas AWS::Lambda::Function
is for usage with plain Cloudformation. They are essentially both modelling Lambda functions, but it is just to different frameworks, that therefore have different names for more or less the same thing.
Conceptually there is no difference between a serverless or a Lambda function. Serverless is the generic term for what AWS calls Lambda (and API Gateway).
The serverless framework is then just a software project that builds upon serverless principles, and that can work with AWS Lambda (amongst others). It's really not much different from other frameworks such a Chalice or Zappa (both Python based serverless frameworks that run on AWS Lambda).
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.