1. Tutorials
  2. Pulumi Fundamentals
  3. Creating Pulumi Projects

Creating Pulumi Projects

Infrastructure in Pulumi is organized into projects. In the Pulumi ecosystem, a project represents a Pulumi program that, when run, declares the desired infrastructure for Pulumi to manage. The program has corresponding stacks, or isolated, independently configurable instances of your Pulumi program. We’ll talk more about stacks later in the Building with Pulumi tutorial.

Create a directory

Each Pulumi project lives in its own directory. Create one now and change into it by running these commands in your terminal:

$ mkdir my-first-app
$ cd my-first-app

Pulumi will use the directory name as your project name by default. To create an independent project, name the directory differently.

Initialize your project

Since a Pulumi project is just a directory with some files in it, it is possible for you to create a new one by hand. The pulumi new command-line interface (CLI) command, however, automates the process and ensures you have everything you need, so let’s use that command. The -y flag answers “yes” to the prompts to create a default project:

$ pulumi new typescript -y
$ pulumi new python -y

This command creates all of the files you need, initializes a new stack named dev (an instance of the project), and installs any necessary dependencies:

Created project 'my-first-app'
# ...

Installing dependencies...
# ...

Finished installing dependencies

Your new project is ready to go! ✨

To perform an initial deployment, run 'pulumi up'
Created project 'my-first-app'
# ...
Created stack 'dev'

Creating virtual environment...
# ...
Finished creating virtual environment

Updating pip, setuptools, and wheel in virtual environment...
# ...
Your new project is ready to go! ✨

To perform an initial deployment, run 'pulumi up'

Inspect your new project

The basic project created by pulumi new is comprised of multiple files:

  • Pulumi.yaml: your project's metadata, containing its name and language
  • index.js index.ts __main__.py main.go Program.cs Program.fs Program.vb App.java Pulumi.yaml : your program's main entrypoint file
  • package.json: your project's Node.js dependency information
  • index.js index.ts __main__.py main.go Program.cs Program.fs Program.vb App.java Pulumi.yaml : your program's main entrypoint file
  • requirements.txt: your project's Python dependency information
  • venv: a virtualenv for your project
  • Open index.js index.ts __main__.py main.go Program.cs Program.fs Program.vb App.java Pulumi.yaml in your editor of choice to have a look at its contents:

    import * as pulumi from "@pulumi/pulumi";
    
    """A Python Pulumi program"""
    
    import pulumi
    

    Feel free to explore the other files as well.

    Now let’s move on to creating your first real bit of infrastructure with Pulumi: some Docker images!