Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Infrastructure as Code with Pulumi
Infrastructure as Code with Pulumi

Infrastructure as Code with Pulumi: Streamlining Cloud Deployments Using Code

eBook
$20.98 $29.99
Paperback
$31.99 $37.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Infrastructure as Code with Pulumi

1 Introduction to Infrastructure as Code and Pulumi

Before you begin: Join our book community on Discord

Give your feedback straight to the author and chat to other early readers on our Discord server.

https://packt.link/mqfS2

With the increasing adoption of cloud technologies and DevOps practices, the ability to define and manage infrastructure through code has become a highly sought-after skill. Developers today are expected not only to build applications but also to deploy, manage, and scale them efficiently in the cloud. Mastering Infrastructure as Code (IaC) is key to meeting these demands, and Pulumi offers a flexible and powerful way to do just that. However, with the vast amount of information available, structuring your learning to effectively adopt Pulumi can feel overwhelming. This chapter, and the rest of this book, aim to simplify the process of understanding IaC and Pulumi, setting you up for success from the start.Beginnings are the...

Technical requirements

If you would like to follow along with the examples in this chapter, you will require the following:

  • The Pulumi CLI is required for executing commands. You can download it from https://www.pulumi.com/docs/iac/download-install/.
  • Pulumi supports multiple programming languages, but for this chapter, we'll be using JavaScript/TypeScript, which requires Node.js. You can download and install it from the Node.js official site here: https://nodejs.org/.

Introduction to IaC

One of the main problems IaC solves is configuration drift. In the early days of managing infrastructure, system administrators would manually configure servers, networks, and storage. Over time, as systems were updated and maintained, the configuration of one server might start to differ from another. This inconsistency, known as configuration drift, could lead to unpredictable behavior, bugs, or failures because different servers no longer worked the same way.Before IaC, the process of managing infrastructure was also slow and prone to human error. If you needed to set up new servers, you'd do it manually, often following a checklist. But if that checklist wasn’t followed exactly or someone made a mistake, the new server might not work properly. Reproducing the exact environment became difficult, and scaling was even harder. If you needed to deploy 10 or 100 servers, you’d have to configure each one individually, which took a lot of...

Installing Pulumi and dependencies

Pulumi is an IaC tool that takes a different approach by treating infrastructure like software. This means that instead of using configuration files in a domain-specific language (DSL) like other IaC tools, you can define and manage your infrastructure using general-purpose programming languages such as JavaScript, Python, TypeScript, Go, or C#. With Pulumi, developers can use familiar coding practices, making it easier to integrate infrastructure management into the software development workflow.The concept of infrastructure as software means that you can manage cloud resources in the same way you manage software code. Just like you write code to build applications, you write code to define your infrastructure. This code can be versioned, tested, reused, and shared, just like application code. This approach brings together the worlds of software development and cloud infrastructure, allowing for more flexible and powerful management.Pulumi...

Understanding resources and stacks

When working with cloud infrastructure, resources are the basic building blocks of your system. These resources represent services such as virtual machines, databases, networking components, and storage systems. Each of these elements is critical to making your applications run efficiently and at scale in the cloud. A resource in Pulumi represents a single cloud infrastructure component. For example, an Amazon EC2 instance, an Azure Blob Storage container, or a Google Cloud SQL instance can all be treated as resources in Pulumi.Here’s an example of a simple Pulumi TypeScript code to define an Azure storage account (a storage resource):

// Create an Azure resource group
const resourceGroup = new azure.resources.ResourceGroup("testgroup");
// Create an Azure storage account
const storage = new azure.storage.StorageAccount("teststorage", {
     resourceGroupName: resourceGroup.name,
     sku: {
  ...

Pulumi state and state management

One of the core concepts when working with IaC tools such as Pulumi is state management. Pulumi tracks the state of your cloud infrastructure, which is necessary to understand what resources exist, their current configuration, and how they relate to each other. This information is crucial when making updates or destroying resources, as it allows Pulumi to know exactly what needs to be created, modified, or deleted.In Pulumi, state refers to a snapshot of the resources that have been deployed by Pulumi in a given stack. Pulumi keeps this state to ensure that it can compare the current live infrastructure with the desired infrastructure defined in your code. This state file is automatically updated whenever you make changes to your infrastructure by running commands such as pulumi up or pulumi destroy.When you run pulumi up, Pulumi takes the infrastructure configuration you've defined in code (such as creating a virtual network or a storage...

The Pulumi programming model

The Pulumi programming model revolves around using standard programming constructs such as loops, conditionals, functions, and variables to define cloud infrastructure. The benefit of using familiar languages is that you can reuse libraries, apply business logic, and manage infrastructure in a more dynamic and flexible way.At a high level, Pulumi works by taking the code you write, comparing it to the current state of your infrastructure, and then applying any necessary changes to reach the desired state. This is done through a series of steps:

  1. Write infrastructure code: You define your cloud infrastructure using code in the programming language of your choice. For example, you might define virtual machines, storage accounts, databases, or networking resources.
  2. Pulumi CLI: The Pulumi CLI is the command-line tool used to manage your Pulumi projects. When you run commands such as pulumi up, Pulumi takes your infrastructure...

Pulumi CLI: key commands and operations

The Pulumi CLI is an essential tool when working with Pulumi. It provides the commands needed to define, deploy, and manage your infrastructure through code. Pulumi’s CLI enables you to create, update, and destroy cloud resources, as well as manage the different stacks (environments) that you’re working with.In this section, we will explore the most important Pulumi CLI commands, how to use them, and what each one does. If you’re working with Pulumi, becoming comfortable with the CLI is crucial, as it’s where you’ll spend most of your time deploying and managing your cloud infrastructure:

  • pulumi new: This command initializes a new Pulumi project. When you’re starting a new infrastructure project, this is the first command you’ll run. It sets up everything you need to begin writing code to manage your cloud resources. Here's how you can use it:
...

Input, output, and configuration

In Pulumi, inputs, outputs, and configuration are essential for managing cloud infrastructure. These concepts work together to allow for the dynamic handling of resources, their dependencies, and environment-specific values.

Inputs

Inputs in Pulumi represent values that are required to configure resources. These values can be static (e.g., hardcoded strings) or dynamic, such as the result of another resource’s creation. Inputs allow Pulumi to manage dependencies between resources. When one resource depends on another (for example, a virtual machine depending on a network), Pulumi handles the ordering and passing of information between them.Let’s start with a simple example. Here, we create a storage account in Azure, passing the resource group name as an input:

// Create a resource group
const rgroup = new azure.resources.ResourceGroup("myResourceGroup");
// Create a storage...

Summary

In this chapter, we covered essential concepts of IaC and the specific steps to get started with Pulumi. We learned how IaC solves issues such as configuration drift and manual errors by allowing infrastructure to be managed as code. The chapter outlined the installation process for Pulumi on different operating systems, followed by explanations of key topics such as resources, stacks, and state management. We also explored how Pulumi handles infrastructure changes by tracking the state and ensuring synchronization between code and the live environment. Important commands such as pulumi up and pulumi stack were discussed, helping you understand how to deploy, update, and destroy cloud resources, as well as manage multiple environments. This chapter provided a solid foundation to begin using Pulumi effectively in cloud projects.In the next chapter, you will build your first Pulumi IaC project, and you’ll be exposed to writing and organizing code, managing configurations...

Questions

  1. What is configuration drift, and how does IaC help prevent it?
  2. How does IaC improve the reproducibility of infrastructure setups?
  3. What are some of the main benefits of using code to manage cloud infrastructure instead of manual configuration?
  4. How can you verify that Pulumi was installed correctly on your machine?
  5. What is a resource in Pulumi, and how is it defined using code?
  6. What is the purpose of stacks in Pulumi, and how do they relate to different environments?
  7. How can you set specific configuration values for different stacks in Pulumi?
  8. What does Pulumi use state files for, and why are they critical to the IaC process?
  9. What are the default and alternative storage options for Pulumi state?
  10. What does the pulumi up command do, and how does it manage infrastructure changes?
  11. How can you preview changes before deploying them in Pulumi, and why is it important?
  12. ...

Further reading

To learn more about the basics of IaC using Pulumi, you can check out this blog post on the Pulumi website: https://www.pulumi.com/what-is/what-is-infrastructure-as-code/.

Left arrow icon Right arrow icon

Key benefits

  • Build, deploy, and automate infrastructure across multiple cloud environments with Pulumi
  • Integrate Pulumi into CI/CD pipelines and enforce governance with Policy as Code practices
  • Seamlessly migrate from Terraform, CloudFormation, and Kubernetes YAML to Pulumi with practical strategies
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

Infrastructure Automation with Pulumi is your ultimate guide to mastering infrastructure as code across multi-cloud environments. This comprehensive resource walks you through setting up Pulumi, deploying across major cloud providers, and confidently scaling complex architectures. Starting with the fundamentals of infrastructure as code, you'll set up Pulumi, learn its core concepts like resources, stacks, and state management, and build your first infrastructure projects. As you progress, you'll explore advanced techniques for deploying on AWS, Azure, Google Cloud, and Kubernetes. You'll also integrate Pulumi into CI/CD pipelines for continuous deployment and automate cloud infrastructure management. You'll dive deep into Pulumi's provider ecosystem, tackle real-world challenges like multi-region, multi-cloud, and hybrid deployments, and ensure compliance using Policy as Code techniques. With practical examples, real-world scenarios, and hands-on exercises, you'll gain the skills to confidently build scalable, secure, and efficient cloud infrastructure using Pulumi. By the end of this book, you'll have mastered Pulumi's advanced capabilities, applied best practices for maintainable and testable infrastructure code, and be ready to migrate existing projects from other IaC tools to Pulumi seamlessly.

Who is this book for?

This book is for cloud engineers, DevOps professionals, infrastructure architects, and software developers who want to automate and modernize their cloud infrastructure using Pulumi. Whether you're transitioning from tools like Terraform, CloudFormation, or Kubernetes YAML, or starting fresh with Pulumi, this guide provides a complete learning path from beginner to advanced practices. Familiarity with cloud concepts and programming fundamentals is recommended.

What you will learn

  • Build Pulumi projects using familiar programming languages
  • Deploy and manage infrastructure across AWS, Azure, Google Cloud, and Kubernetes
  • Use Pulumi to automated infrastructure management
  • Explore Pulumi's provider ecosystem
  • Manage multi-region, multi-cloud, and hybrid cloud deployments effectively
  • Apply programming best practices to write scalable, maintainable Pulumi code
  • Implement testing, debugging, and policy as code for secure, compliant deployments
  • Migrate infrastructure projects from Terraform, CloudFormation, ARM, and Kubernetes YAML

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 25, 2025
Length: 384 pages
Edition : 1st
Language : English
ISBN-13 : 9781835465219
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Sep 25, 2025
Length: 384 pages
Edition : 1st
Language : English
ISBN-13 : 9781835465219
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Table of Contents

22 Chapters
Part 1: Introduction to Pulumi and Infrastructure as Code Chevron down icon Chevron up icon
Introduction to Infrastructure as Code and Pulumi Chevron down icon Chevron up icon
Creating Your First Pulumi IaC Chevron down icon Chevron up icon
Part 2: Deploying Infrastructure Across Major Cloud Providers Chevron down icon Chevron up icon
Deploying with Pulumi on AWS Chevron down icon Chevron up icon
Deploying with Pulumi on Azure Chevron down icon Chevron up icon
Deploying with Pulumi on Google Cloud Chevron down icon Chevron up icon
Deploying with Pulumi on Kubernetes Chevron down icon Chevron up icon
Part 3: Integration and Cross-Provider Capabilities Chevron down icon Chevron up icon
Integrating Pulumi with CI/CD Pipelines Chevron down icon Chevron up icon
Exploring Pulumi’s Provider Ecosystem Chevron down icon Chevron up icon
Managing your IaC in Multiple Regions and Environments Chevron down icon Chevron up icon
Managing Multi-Cloud and Hybrid Scenarios Chevron down icon Chevron up icon
Part 4: Advanced Features, Best Practices and Hands-On Examples Chevron down icon Chevron up icon
Advanced Pulumi Features Chevron down icon Chevron up icon
Writing Maintainable, Testable, and Scalable Code in Pulumi Chevron down icon Chevron up icon
Testing and Debugging Your Pulumi IaC Chevron down icon Chevron up icon
Implementing Policy as Code Chevron down icon Chevron up icon
Migrating from Other Tools to Pulumi Chevron down icon Chevron up icon
Tests and Exercises on Infrastructure Automation with Pulumi Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.

Modal Close icon
Modal Close icon