Need advice about which tool to choose?Ask the StackShare community!
Pulumi vs Serverless: What are the differences?
Introduction
In this article, we will compare Pulumi and Serverless, two popular tools used in the field of cloud computing and serverless architectures. Both Pulumi and Serverless help developers in deploying and managing cloud resources, but they have some key differences that set them apart.
Language Support: Pulumi allows developers to use familiar programming languages such as JavaScript, Python, TypeScript, and Go to define infrastructure as code. On the other hand, Serverless primarily supports YAML or JSON syntax for defining serverless functions and resources.
Deployment Targets: Pulumi supports multiple cloud providers including AWS, Azure, Google Cloud, and Kubernetes. It allows developers to deploy their infrastructure resources to a wide range of platforms. Serverless, on the other hand, is designed specifically for deploying serverless functions to cloud platforms like AWS Lambda.
Resource Abstraction: Pulumi follows a resource-centric approach, where developers define cloud resources explicitly and have fine-grained control over them. Serverless, on the other hand, abstracts away most of the cloud resources and focuses on serverless functions and events.
State Management: Pulumi uses a declarative model for infrastructure deployment and leverages a state file to manage the infrastructure's current status. This allows for easy updates and rollbacks. Serverless primarily relies on the cloud provider's native infrastructure management systems and does not maintain a state file.
Development Workflow: With Pulumi, developers can use their preferred Integrated Development Environment (IDE) and coding practices. They have the flexibility to use version control systems and can develop infrastructure code just like they would develop any other software project. Serverless, being more focused on just serverless functions, doesn't provide the same level of development workflow flexibility.
Community and Ecosystem: Pulumi has a growing community and an expanding ecosystem of libraries and packages for various cloud providers and programming languages. It offers support for a wide range of cloud services and integration options. Serverless, being more specialized, has a more established community focused on serverless architectures, with a variety of plugins and integrations specifically designed for serverless workflows.
In summary, Pulumi provides greater language support, supports multiple deployment targets, offers fine-grained control over resources, uses declarative state management, provides a flexible development workflow, and has a growing community and ecosystem. Serverless, on the other hand, is more specialized for serverless functions, relies on cloud provider infrastructure management, and has a more established community for serverless architectures.
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.
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.
AdvantagesTerraform 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.
DisadvantagesSoftware 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.
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.
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
Pros of Pulumi
- Infrastructure as code with less pain8
- Best-in-class kubernetes support4
- Simple3
- Can use many languages3
- Great CLI2
- Can be self-hosted2
- Multi-cloud2
- Built-in secret management1
Pros of Serverless
- API integration14
- Supports cloud functions for Google, Azure, and IBM7
- Lower cost3
- Auto scale1
- Openwhisk1