Hi! I really like the idea of building a framework over amazon lambda, though I cannot understand what is the difference between serverless framework and just using amazon's lambda API?
What are the benefits of using serverless? The quickstart does not make it obvious
Hey @DataGreed 馃憢
Great question. Thanks for asking.
AWS has introduced Lambda as a way to run functions / code when pre-defined events occur. This could be an API Gateway request, a new row which was added in DynamoDB or something happened in your S3 bucket.
You could use the AWS SDK, AWS CLI or the web console to setup all the necessary resources (e.g. S3 buckets, Lambda functions, DynamoDB tables, etc.) and their dependencies.
However this can be a tedious process. Let's imagine you want to use a S3 bucket which should trigger a Lambda function whenever you upload a new image (the typical "create a thumbnail example").
Here are the steps involved to setup everything:
With Serverless you define a serverless.yml which describes your setup and your function code and drop both into a directory:
# serverless.yml
service: image-transformer
provider:
name: aws
runtime: nodejs6.10
functions:
imageTransformer:
handler: handler.run
events:
- s3: my-images
After installing the Serverless Framework CLI tool via npm install -g serverless you simply run serverless deploy in your directory and Serverless will do its thing. It will zip your function code, create all the resources and permissions and so on and so forth.
Your service can be as complex as you want it to be. Furthermore the Serverless Framework is built with extensibility in mind. Everything is a plugin and you can build and drop in your own plugins to extend the functionality.
Provider implementations are also shipped as plugins. This way you could e.g. deploy to Azure, OpenWhisk or Google Cloud.
Definitely check out the docs, examples and plugins:
Let us know if you have any questions or need additional information.
Most helpful comment
Hey @DataGreed 馃憢
Great question. Thanks for asking.
AWS has introduced Lambda as a way to run functions / code when pre-defined events occur. This could be an API Gateway request, a new row which was added in DynamoDB or something happened in your S3 bucket.
You could use the AWS SDK, AWS CLI or the web console to setup all the necessary resources (e.g. S3 buckets, Lambda functions, DynamoDB tables, etc.) and their dependencies.
However this can be a tedious process. Let's imagine you want to use a S3 bucket which should trigger a Lambda function whenever you upload a new image (the typical "create a thumbnail example").
Here are the steps involved to setup everything:
With Serverless you define a
serverless.ymlwhich describes your setup and your function code and drop both into a directory:After installing the Serverless Framework CLI tool via
npm install -g serverlessyou simply runserverless deployin your directory and Serverless will do its thing. It will zip your function code, create all the resources and permissions and so on and so forth.Your service can be as complex as you want it to be. Furthermore the Serverless Framework is built with extensibility in mind. Everything is a plugin and you can build and drop in your own plugins to extend the functionality.
Provider implementations are also shipped as plugins. This way you could e.g. deploy to Azure, OpenWhisk or Google Cloud.
Definitely check out the docs, examples and plugins:
Let us know if you have any questions or need additional information.