Infrastructure as a code is one of the greatest changes brought by DevOps in recent times. Complicated provisioning, deployment and release of cloud infrastructure processes which required following complicated steps where cloud resources were created manually is a thing of the past. Infrastructure as a code (IaC) allows to automate provisioning of cloud resources in a consistent and standardized manner. IaC lets you declare your infrastructure using code or configuration files and instructions to create/provision all resources on cloud providers like AWS. There are a wide range of tools to deploy IaC.
Today we look more in detail about two important terminologies Serverless computing and terraform understand their key differences, benefits and purpose they adopted for.
About Serverless Computing
Server less model helps to provision and deploy server less functions across different cloud providers. Server less computing provides backend services on as used basis and users can write and deploy code without worrying about infrastructure underneath. Backend services are charged on the basis of actual computation usage. There is no reservation of any sort in terms of bandwidth, number of servers as the service operates in auto scale mode.
Though by name it is server less, physical servers are there in underlying infrastructure which developers are not aware of. Backend services consist of a server where application files reside and database where user and business data is stored.
Serverless computing offers Function as a service (FaaS), like Cloudflare workers , it allows developers to execute small pieces of code on the network edge. With FaaS developers can build modular architecture , a scalable codebase without the need to spend resources to maintain the underlying backend infrastructure.
Benefits of Serverless Computing
- Very cost effective as compared to its counterpart traditional cloud providers of backend services as users end up paying for unused or idle CPU times
- Developers need not to worry about scaling up their code as it can handle all application scaling demands
- Simple functions can be created by developers in FaaS to perform a single independent function such as call to an API
- Significantly can cut time to market as code can be added and modified on piecemeal basis
‘Infrastructure as a code’ tool is one of the most popular IaC tools with huge providers. It allows to configure and provision infrastructure. Terraform is an open-source infrastructure as a code software which provides a consistent CLI workflow to manage multitude of cloud services. It codifies Cloud APIs into declarative configuration files. It can be used with any cloud provider.
Benefits of Terraform
- It supports orchestration not just configuration management
- Supports multiple providers such as AWS, Azure, GCP, DigitalOcean etc.
- Provides immutable infrastructure to support smooth infrastructure changes
- Easy to understand language , HCL (Hashicorp configuration language)
- Supports portability to any other provider
- Supports client only architecture no need for additional configuration management on server
Comparison Table: Serverless vs Terraform
Below table summarizes the differences between the two:
|Scope||Cross platform support via service providers||Covers most AWS resources and part of it offers faster support for new AWS features|
|License||Open source and enterprise||It is an open-source project|
|Support||Based on subscription model chosen||Hashicorp offers 24*7 support|
|Type||It is a framework and stateless||It is an orchestration tool and stateful application|
|VM provisioning , network and storage management||Offloads all backend management responsibility and operations tasks such as provisioning, scheduling, scaling etc.||It offers comprehensive VM provisioning, network and storage management|
|Services||AWS Lambda, Microsoft Azure Functions, Google Cloud Functions and IBM OpenWhisk||Terraform is open-source infrastructure as code software tool|
Download the comparison table: Serverless vs Terraform