Pulumi
Pulumi is a modern Infrastructure as Code (IAC) tool that allows developers to use familiar programming languages and tools to provision, manage, and deploy cloud infrastructure. With Pulumi, you can write code in languages like JavaScript, TypeScript, Python, and Go to define your infrastructure, making it more manageable and versionable than traditional IAC methods.
This allows developers to use the same tools and workflows they're already familiar with, making it easier to automate and manage their infrastructure.
In this blog, we'll take a closer look at Pulumi and how it can help you simplify your infrastructure management.
Uses
Create Modernized Applications.
Deploy to ANY cloud using ANY CI/CD tool.
Manage Cloud Environments.
Why Pulumi🤔?
But you might ask, why should I use Pulumi instead of other Infrastructure as Code tools like Terraform, Chef, and Puppet?
Features | Pulumi | Terraform |
Programming Language | JavaScript, TypeScript, Python, Go | HashiCorp Configuration Language (HCL) |
Testing and Validation | Unit, property, and integration testing. Supports popular test frameworks. | Integration testing only |
Reusability of Code | Allowed | Not Allowed |
Ease of Learning | Easy to learn | Comparatively Difficult |
IDE Support | Code completion, strong typing, error squiggles, rich resource documentation, etc. | Limited |
How Pulumi works?
Pulumi uses states to describe what operation must be performed on resources. This is called the Pulumi State Model and it consists of four basic components:
1. Language Host
The language host is the component that allows developers to use familiar programming languages to define their cloud infrastructure.
It communicates with the Pulumi engine, translates the developer's code and facilitates communication between the developer's code and the underlying cloud resources.
2. Deployment Engine
The deployment engine is responsible for creating, updating and deleting cloud resources as defined by the developer's code.
It communicates with the cloud provider's API and ensures that the infrastructure is in the desired state by tracking the current and desired state of resources.
3. Resource Providers
Resource providers are the components that provide the implementation for the different types of resources that can be managed with Pulumi. They are responsible for creating, updating, and deleting resources on the cloud provider's API.
Each provider is specific to a cloud provider and the type of resource it manages, they use the cloud provider's SDKs to communicate with the cloud provider's API and perform the necessary tasks.
4. States
Each resource has a current state and desired state, which can be changed when Pulumi performs operations in them.
Pulumi Programming Model
There are 3 major components in a Pulumi Project
1. Project
A project is a directory that includes a program and a .yaml
file with configurations that lets Pulumi know how to run the program.
The Pulumi.yaml file contains important metadata such as the name and description of the project, the programming language chosen, and more optional configurations.
2. Program
A program is a collection of files that the project uses to run. These files are written in the programming language that is defined in the Pulumi.yaml
file.
As Pulumi programs are written in familiar languages, you can use their native libraries, but to deploy your infrastructure, you will also need to use Pulumi’s packages and their resource types. You can set your program to generate outputs that will be available in the stack that is running it.
3. Stack
A stack is an instance of a project, you can have as many stacks as you want, and they are usually used for different cloud environments, stages, or branches. Each stack has its own Pulumi.<stack>.yaml
file, so it can be configured independently.
You can do basic operations like create, select, and destroy stacks using the CLI, it also, provides you with more specific features such as listing, tagging, importing and exporting stacks, and viewing their outputs.
Further Reading:
Conclusion 😊
In conclusion, Pulumi is a powerful and modern Infrastructure as Code (IAC) tool that allows developers to use familiar programming languages and tools to provision, manage, and deploy cloud infrastructure, thus providing a developer-friendly approach to managing infrastructure.
Thank you for reading my article and if you liked my blog post then please like it and share this with your friends and colleagues
If you don't want to miss my future blogs then you can join my newsletter.