Gernot Glawe
Aug 23, 2017 · 2 min read

There is some misconception about serverless (sls) and cloudformation here.

  1. sls creates large bundles: Thats partially right, the bundle includes all role and stuff that you need for the lambda function anyway. This is the stuff you have to add by yourself with terraform. Sls also adds an s3 bucket, which you can share if you want.
  2. When you deploy the second time with sls, it actually also does an update of just the changed items. This is a core concept of cloudformation which is used under the hood— if you apply the template file a second time, the ressources which are unchanged will not be touched. (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks.html)
  3. Speed: with sls you can choose to update the whole ressource stack with “deploy” or just the function code “sls deploy function”. The deploy function gives the the module bundler for free. (https://serverless.com/framework/docs/providers/aws/cli-reference/deploy-function/)
  4. Additional ressources: You can include all needed ressources (SQS, SNS, what have you) as cloudformation into the serverless.yaml

(https://serverless.com/framework/docs/providers/aws/guide/serverless.yml/

resources: Resources: usersTable: Type: AWS::DynamoDB::Table….)

ApiGateway

The real advange comes when you use api gateway. In Serverless you can get one with about 3 lines of configuration, in terraform its about 50 lines.

# serverless.yml functions: index: handler: handler.hello events: — http: GET hello

See https://serverless.com/framework/docs/providers/aws/events/apigateway/

for the short version and

Terraform aws_api_gateway_resource, rest api and other for the long version.

So i disagree with your summary, that “there are many cases where frameworks such as SAM or Serverless are not enough.” Ok, there are some cases. But if you use a lambda function, you will be *much* faster with serverless, because you have to add a module bundler, roles and other stuff manually.

)
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade