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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With