Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would you compare Hashicorp-Terraform with serverless framework?

I would like to know what is the difference between Terraform and Serverless. Arent they doing the same thing like managing your infrastructure, and representing your infrastructure as code?

Do you really need a serverless framework (serverless.com)?

Thanks

like image 618
obaid Avatar asked Nov 24 '17 20:11

obaid


2 Answers

My understanding for serverless framework and other similar serverless-focus tools:

Both Serverless Framework and Terraform support different cloud providers. Use AWS as sample in next statements.

Compare Serverless framework to Terraform, serverless framework is serverless specialist, Terraform is GP

terraform is fully Infrastructure as Code which covered most resources.

Serverless framework is a middle layer only to generate Cloudformation template which mostly for serverless related resources, in aws, focus on lambda, api gateway, dynamodb, etc.

You can write all in Cloudformation template directly, but the template file will be huge, it is hard to maintain by its JSON/Yaml template as well. With a few dozen lines in serverless.yml, serverless framework can generate a thousand or several thousand lines of cloudformation template. It saves a lot of time to deal with the cloudformation coding. By the way, if you already knew cloudformation syntax, you can easily put the same cloudformation yaml codes directly in the resources part, serverless template knows how to create them.

You can write Terraform codes to manage lambda, api gateway, Dynamodb as well. Maybe you can get less codes than Cloudformation template, but still too complicated.

In another way, it doesn't make sense to let serverless framework deal with all AWS resources, that other tools do most well already, such as EC2, VPC, ECS, etc.

Serverless framework is still in developing, because of its popularity, many developers are involved to add features into it daily. Maybe one day you can get what you need, but now you have to mix serverless framework with Cloudformation or Terraform or other tools together in some case.

like image 107
BMW Avatar answered Sep 21 '22 05:09

BMW


The most obvious difference is that serveless architecture focuses on function-as-a-service and terraform is designed to manage infrastracture including your EC2 and ECS instances.Serveless.com might be more suited for AWS Lambda deployments (and it's equivalents in other clouds) but it can't manage your virtual machines, load balancers and all the other.

like image 28
Jakub Kania Avatar answered Sep 21 '22 05:09

Jakub Kania