Need advice about which tool to choose?Ask the StackShare community!

Serverless

1.3K
1.2K
+ 1
26
Terraform

18.4K
14.5K
+ 1
344
Add tool

Serverless vs Terraform: What are the differences?

Serverless and Terraform are two popular technologies used in web development and infrastructure management. While both have their own unique features and functionalities, they also have some key differences that set them apart from each other. This markdown code aims to highlight and provide a concise description of these differences.

  1. Scalability: Serverless architecture allows applications to automatically scale up or down based on demand. It abstracts the infrastructure layer and manages the scaling on behalf of the developers. On the other hand, Terraform is an infrastructure-as-code tool that provides scalability through defining resources and their configurations in the code. It allows developers to specify the desired state of their infrastructure and make changes accordingly.

  2. Vendor Lock-In: Serverless platforms are often tied to a specific cloud provider, such as AWS Lambda or Azure Functions. This can result in vendor lock-in, making it difficult to switch to another provider. Terraform, on the other hand, is cloud-agnostic and supports multiple cloud providers. It allows developers to define resources using a consistent language across different platforms, reducing vendor dependency.

  3. Cost Management: Serverless architectures have a pay-per-use pricing model, where developers are charged based on the actual usage of their applications. This can be advantageous for applications with unpredictable or varying workloads. Terraform, on the other hand, does not directly handle cost management. It focuses on infrastructure provisioning and management, and developers need to manage the cost of resources manually.

  4. Flexibility: Serverless architectures provide a high level of flexibility, allowing developers to focus on writing code without worrying about infrastructure management. It abstracts away infrastructure details, making it easier to deploy and maintain applications. Terraform, on the other hand, offers more control and flexibility in defining infrastructure configurations. Developers can specify resource parameters and dependencies, giving them granular control over their infrastructure.

  5. Execution Environment: Serverless platforms provide isolated execution environments for applications, ensuring that one application does not impact the performance or security of other applications. Terraform, on the other hand, does not provide execution environments as it focuses on provisioning and managing infrastructure. It is mainly used in conjunction with other tools and platforms to run applications.

  6. Deployment Time: Serverless architectures offer faster deployment times as the infrastructure is managed by the platform. Developers can quickly deploy their applications without worrying about configuring servers or managing infrastructure. Terraform, on the other hand, may have longer deployment times, especially for larger infrastructures. It requires the creation and configuration of resources, which can take more time depending on the complexity of the infrastructure.

In summary, Serverless architecture provides automatic scaling, vendor lock-in, cost management, flexibility, isolated execution environments, and faster deployment times, while Terraform focuses on cloud-agnostic infrastructure provisioning, offers more control and flexibility, does not handle cost management directly, does not provide execution environments, and may have longer deployment times.

Decisions about Serverless and Terraform

Because Pulumi uses real programming languages, you can actually write abstractions for your infrastructure code, which is incredibly empowering. You still 'describe' your desired state, but by having a programming language at your fingers, you can factor out patterns, and package it up for easier consumption.

See more
Sergey Ivanov
Overview

We use Terraform to manage AWS cloud environment for the project. It is pretty complex, largely static, security-focused, and constantly evolving.

Terraform provides descriptive (declarative) way of defining the target configuration, where it can work out the dependencies between configuration elements and apply differences without re-provisioning the entire cloud stack.

Advantages

Terraform is vendor-neutral in a way that it is using a common configuration language (HCL) with plugins (providers) for multiple cloud and service providers.

Terraform keeps track of the previous state of the deployment and applies incremental changes, resulting in faster deployment times.

Terraform allows us to share reusable modules between projects. We have built an impressive library of modules internally, which makes it very easy to assemble a new project from pre-fabricated building blocks.

Disadvantages

Software is imperfect, and Terraform is no exception. Occasionally we hit annoying bugs that we have to work around. The interaction with any underlying APIs is encapsulated inside 3rd party Terraform providers, and any bug fixes or new features require a provider release. Some providers have very poor coverage of the underlying APIs.

Terraform is not great for managing highly dynamic parts of cloud environments. That part is better delegated to other tools or scripts.

Terraform state may go out of sync with the target environment or with the source configuration, which often results in painful reconciliation.

See more

I personally am not a huge fan of vendor lock in for multiple reasons:

  • I've seen cost saving moves to the cloud end up costing a fortune and trapping companies due to over utilization of cloud specific features.
  • I've seen S3 failures nearly take down half the internet.
  • I've seen companies get stuck in the cloud because they aren't built cloud agnostic.

I choose to use terraform for my cloud provisioning for these reasons:

  • It's cloud agnostic so I can use it no matter where I am.
  • It isn't difficult to use and uses a relatively easy to read language.
  • It tests infrastructure before running it, and enables me to see and keep changes up to date.
  • It runs from the same CLI I do most of my CM work from.
See more

Context: I wanted to create an end to end IoT data pipeline simulation in Google Cloud IoT Core and other GCP services. I never touched Terraform meaningfully until working on this project, and it's one of the best explorations in my development career. The documentation and syntax is incredibly human-readable and friendly. I'm used to building infrastructure through the google apis via Python , but I'm so glad past Sung did not make that decision. I was tempted to use Google Cloud Deployment Manager, but the templates were a bit convoluted by first impression. I'm glad past Sung did not make this decision either.

Solution: Leveraging Google Cloud Build Google Cloud Run Google Cloud Bigtable Google BigQuery Google Cloud Storage Google Compute Engine along with some other fun tools, I can deploy over 40 GCP resources using Terraform!

Check Out My Architecture: CLICK ME

Check out the GitHub repo attached

See more

When adding a new feature to Checkly rearchitecting some older piece, I tend to pick Heroku for rolling it out. But not always, because sometimes I pick AWS Lambda . The short story:

  • Developer Experience trumps everything.
  • AWS Lambda is cheap. Up to a limit though. This impact not only your wallet.
  • If you need geographic spread, AWS is lonely at the top.
The setup

Recently, I was doing a brainstorm at a startup here in Berlin on the future of their infrastructure. They were ready to move on from their initial, almost 100% Ec2 + Chef based setup. Everything was on the table. But we crossed out a lot quite quickly:

  • Pure, uncut, self hosted Kubernetes — way too much complexity
  • Managed Kubernetes in various flavors — still too much complexity
  • Zeit — Maybe, but no Docker support
  • Elastic Beanstalk — Maybe, bit old but does the job
  • Heroku
  • Lambda

It became clear a mix of PaaS and FaaS was the way to go. What a surprise! That is exactly what I use for Checkly! But when do you pick which model?

I chopped that question up into the following categories:

  • Developer Experience / DX 🤓
  • Ops Experience / OX 🐂 (?)
  • Cost 💵
  • Lock in 🔐

Read the full post linked below for all details

See more
Praveen Mooli
Engineering Manager at Taylor and Francis · | 19 upvotes · 4M views

We are in the process of building a modern content platform to deliver our content through various channels. We decided to go with Microservices architecture as we wanted scale. Microservice architecture style is an approach to developing an application as a suite of small independently deployable services built around specific business capabilities. You can gain modularity, extensive parallelism and cost-effective scaling by deploying services across many distributed servers. Microservices modularity facilitates independent updates/deployments, and helps to avoid single point of failure, which can help prevent large-scale outages. We also decided to use Event Driven Architecture pattern which is a popular distributed asynchronous architecture pattern used to produce highly scalable applications. The event-driven architecture is made up of highly decoupled, single-purpose event processing components that asynchronously receive and process events.

To build our #Backend capabilities we decided to use the following: 1. #Microservices - Java with Spring Boot , Node.js with ExpressJS and Python with Flask 2. #Eventsourcingframework - Amazon Kinesis , Amazon Kinesis Firehose , Amazon SNS , Amazon SQS, AWS Lambda 3. #Data - Amazon RDS , Amazon DynamoDB , Amazon S3 , MongoDB Atlas

To build #Webapps we decided to use Angular 2 with RxJS

#Devops - GitHub , Travis CI , Terraform , Docker , Serverless

See more
Manage your open source components, licenses, and vulnerabilities
Learn More
Pros of Serverless
Pros of Terraform
  • 14
    API integration
  • 7
    Supports cloud functions for Google, Azure, and IBM
  • 3
    Lower cost
  • 1
    Auto scale
  • 1
    Openwhisk
  • 121
    Infrastructure as code
  • 73
    Declarative syntax
  • 45
    Planning
  • 28
    Simple
  • 24
    Parallelism
  • 8
    Well-documented
  • 8
    Cloud agnostic
  • 6
    It's like coding your infrastructure in simple English
  • 6
    Immutable infrastructure
  • 5
    Platform agnostic
  • 4
    Extendable
  • 4
    Automation
  • 4
    Automates infrastructure deployments
  • 4
    Portability
  • 2
    Lightweight
  • 2
    Scales to hundreds of hosts

Sign up to add or upvote prosMake informed product decisions

Cons of Serverless
Cons of Terraform
    Be the first to leave a con
    • 1
      Doesn't have full support to GKE

    Sign up to add or upvote consMake informed product decisions

    What is Serverless?

    Build applications comprised of microservices that run in response to events, auto-scale for you, and only charge you when they run. This lowers the total cost of maintaining your apps, enabling you to build more logic, faster. The Framework uses new event-driven compute services, like AWS Lambda, Google CloudFunctions, and more.

    What is Terraform?

    With Terraform, you describe your complete infrastructure as code, even as it spans multiple service providers. Your servers may come from AWS, your DNS may come from CloudFlare, and your database may come from Heroku. Terraform will build all these resources across all these providers in parallel.

    Need advice about which tool to choose?Ask the StackShare community!

    What companies use Serverless?
    What companies use Terraform?
    Manage your open source components, licenses, and vulnerabilities
    Learn More

    Sign up to get full access to all the companiesMake informed product decisions

    What tools integrate with Serverless?
    What tools integrate with Terraform?

    Sign up to get full access to all the tool integrationsMake informed product decisions

    Blog Posts

    GitGitHubPython+22
    17
    14281
    JavaScriptGitHubPython+42
    53
    22159
    What are some alternatives to Serverless and Terraform?
    AWS Lambda
    AWS Lambda is a compute service that runs your code in response to events and automatically manages the underlying compute resources for you. You can use AWS Lambda to extend other AWS services with custom logic, or create your own back-end services that operate at AWS scale, performance, and security.
    Zappa
    Zappa makes it super easy to deploy all Python WSGI applications on AWS Lambda + API Gateway. Think of it as "serverless" web hosting for your Python web apps. That means infinite scaling, zero downtime, zero maintenance - and at a fraction of the cost of your current deployments!
    Kubernetes
    Kubernetes is an open source orchestration system for Docker containers. It handles scheduling onto nodes in a compute cluster and actively manages workloads to ensure that their state matches the users declared intentions.
    NGINX
    nginx [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server, written by Igor Sysoev. According to Netcraft nginx served or proxied 30.46% of the top million busiest sites in Jan 2018.
    Apache HTTP Server
    The Apache HTTP Server is a powerful and flexible HTTP/1.1 compliant web server. Originally designed as a replacement for the NCSA HTTP Server, it has grown to be the most popular web server on the Internet.
    See all alternatives