Pulumi Unleashed: Simplifying Cloud Infrastructure

Juan Botero
5 min readJan 6, 2024

--

Introduction to Pulumi 📎

Pulumi is an open-source infrastructure-as-code (IaC) tool designed for creating, deploying, and managing cloud infrastructure. It supports various providers such as AWS, Azure, GCP, Kubernetes, Datadog, Github, and more (refer to the list at https://www.pulumi.com/registry/).

As a declarative IaC tool, Pulumi allows the configuration and resource definition using common programming languages like JavaScript, Go, Python, Java, and .NET. This approach provides programming languages with benefits such as libraries, operators, implementations, and experience.

Pulumi consists of different components:

SDK: Provides tools and libraries for managing cloud and provider resources. Each provider has its own library, and providers may have different varieties, including classic, less abstracted resources. The ability to create libraries for development groups or teams within a company is truly beneficial, enabling easy configuration sharing and simplifying cloud configuration.

CLI (Command-Line Interface): This tool executes the code and connects with the backend state service to manage the desired state and actual state. It configures the runtime, actual stack, logs user activity, and features for code execution. Creating your own image with the Pulumi CLI included allows you to run it on your CI/CD pipeline, enhancing automation capabilities.

Comparison with other IaC tools 📑

Pulumi boasts several features that set it apart from other tools, including its ability to support multiple programming languages, availability of both cloud-hosted and self-hosted backends, support for multiple cloud providers, a growing community, an easy learning curve, cloud agnosticism, and being an open-source solution.

In comparison to other tools, such as Terraform, which has been in the market for a longer duration, you can find more documentation and custom providers that may assist you in the decision-making process. However, given the rapid pace at which Pulumi is advancing, it is expected to narrow the gap further.

Hands on! 👐

First, we need to install the Pulumi CLI, configure Pulumi, choose our preferred language, and select the cloud provider

## Pulumi CLI install
# MacOs
brew install pulumi/tap/pulumi
# Windows
choco install pulumi
# Linux
curl -fsSL <https://get.pulumi.com> | sh

Pulumi Cloud is free for single purposes and provides dashboards and state storage for resources. To get started, create an account at https://app.pulumi.com/signin and log in.

pulumi login
# Press enter and login with the browser

Let’s create the project in a directory

mkdir pulumi-test-gcp
cd pulumi-test-gcp
pulumi new gcp-typescript --name gcp-test-storage --stack dev --description "This is a test" -y
pulumi config set gcp:project <GCP_PROJECT_ID>

See that new files has been created inside the directory

The code is defined in index.ts, Pulumi.yaml contains the project configuration, and Pulumi.dev.yaml includes the stack configuration, such as the GCP project ID that we have configured.

Let’s install the packages, as we are using Typescript, then we are going to use NPM.

npm install

Once we are authenticated with Pulumi cloud, now we need to configure the credentials for GCP

gcloud auth application-default login

In this case we are going to use Typescript and Google Cloud to create a cloud storage.

Depending on the resource they can have different variables.

Let’s run and create the resource

pulumi up -s dev

Press yes and go to your GCP console

The name has a generated ID as GCP handles unique names for storages.

Let’s clean and destroy all.

pulumi destroy -s dev -y
pulumi stack rm dev -y

That’s all!! 🚀

Conclusion

In this journey through the world of Pulumi, we’ve explored the fundamental concepts and practical example. As we wrap up, let’s take a moment to compare Pulumi with other popular tools in the same space.

  • Developer-Friendly Approach: Pulumi stands out for its developer-centric approach, allowing users to leverage familiar programming languages like JavaScript, TypeScript, Python, Go, and .NET. This flexibility enables development teams to seamlessly integrate infrastructure code with application code, fostering collaboration and reducing the learning curve.
  • Declarative vs. Imperative Paradigms: Unlike some traditional IaC tools that follow a declarative approach, Pulumi provides the option for both declarative and imperative styles. This flexibility empowers users to choose the best-suited paradigm for their specific use cases, whether it’s describing the desired state or implementing custom logic in the infrastructure code.
  • Multi-Language Support: Pulumi’s extensive support for multiple programming languages opens the door to a broader community of developers. This versatility contrasts with some IaC tools that are limited to a specific language, potentially restricting adoption within diverse tech stacks.
  • Ease of Adoption: The simplicity of getting started with Pulumi, coupled with its comprehensive documentation and active community, contributes to a smooth onboarding process. Developers can rapidly transition from initial exploration to building complex infrastructure stacks, reducing barriers to entry.
  • Ecosystem Integration: Pulumi seamlessly integrates with popular cloud providers such as AWS, Azure, and Google Cloud, providing first-class support for their services. The ability to work directly with cloud-native APIs allows users to stay in sync with the latest features and innovations.
  • Comparative Performance: While individual performance benchmarks may vary based on specific use cases, Pulumi generally demonstrates competitive performance in terms of resource provisioning and orchestration. Users can benefit from a balance between speed and flexibility when defining and managing infrastructure.
  • Community and Ecosystem: Pulumi’s growing community and ecosystem contribute to its strength. Engaging forums, educational resources, and community-driven extensions enrich the overall experience, fostering a collaborative environment for knowledge sharing and problem-solving.

In conclusion, Pulumi emerges as a robust choice for modern infrastructure as code, combining developer-friendly practices, multi-language support, and a vibrant community. While each tool has its strengths, Pulumi’s unique features make it an attractive option for teams seeking a flexible, efficient, and scalable IaC solution.

As technology continues to evolve, embracing tools like Pulumi ensures that development and operations teams can adapt seamlessly to changing requirements and deliver infrastructure with agility and confidence. Explore, experiment, and consider integrating Pulumi into your toolkit for a more streamlined and enjoyable infrastructure management experience.

Thank you for reading, and I hope this has been helpful to you. See you soon!

https://www.linkedin.com/in/juanfbl9307/

https://tritontechsolutions.com/

https://github.com/juanfbl9307

--

--

Juan Botero

DevOps Engineer | CI/CD & Cloud Infrastructure Specialist | Championing Automation & Efficiency in Software Delivery | Platform Engineer