2 Your first Pulumi program

 

This chapter covers:

  • Setting up your command-line tools
  • Generating a new Pulumi program from a template
  • Understanding the parts of a Pulumi program
  • Building a serverless text-messaging application with Pulumi and AWS
  • Creating, deploying, and updating a Pulumi stack
  • Getting acquainted with the Pulumi Console

In chapter one, we covered a number of high-level topics like infrastructure as code and the parts of Pulumi, and you got a glimpse of what it’s like to work with Pulumi by taking a walk through a simple project. In this chapter, we’ll bring all of that knowledge forward and use it to build your first Pulumi program — a humble but practical application that uses Pulumi with AWS.

Books, blogs, and other infrastructure-as-code resources sometimes suffer from being a bit too abstract. If you’re like me, you might appreciate knowing how easy it is to create a dozen virtual machines with a for loop, but question the value of that knowledge without something practical to do with it. Solutions without problems are only marginally interesting to me. What I love most about infrastructure-as-code, and about Pulumi especially, is how it enables me to build applications that solve real problems — my problems — even when those problems happen to be, well, somewhat trivial.

2.1  Enter serverless

2.2  Building the serverless cloud notifier

2.2.1  Configuring your command-line tools

2.3  Creating the project and stack

2.3.1  Specifying your project settings

2.4  Understanding the new project layout

2.4.1  index.ts

2.4.2  package.json, package-lock.json and node_modules

2.4.3  tsconfig.json

2.4.4  Pulumi.yaml and Pulumi.dev.yaml

2.5  Writing the code

2.5.1  Creating the topic and subscription

2.5.2  Scheduling and handling events

2.6  Deploying the application

2.6.1  Tailing the logs

2.6.2  Publishing text messages

2.7  Updating the application

2.8  Browsing the stack