Pulumi CLI

Pulumi is controlled primarily using the command line interface (CLI). It works in conjunction with the Pulumi service to deploy changes to your cloud apps and infrastructure. It keeps a history of who updated what in your team and when. This CLI has been designed for great inner loop productivity, in addition to continuous integration and delivery scenarios.

Installation

The Pulumi CLI is free to download and install:

Install Pulumi

Common Commands

The most common commands in the CLI that you’ll be using are as follows:

  • pulumi new: creates a new project using a template
  • pulumi stack: manage your stacks (at least one is required to perform an update)
  • pulumi config: configure variables such as keys, regions, and so on
  • pulumi up: preview and deploy changes to your program and/or infrastructure
  • pulumi preview: preview your changes explicitly before deploying
  • pulumi destroy: destroy your program and its infrastructure when you’re done

Environment Variables

For a list of environment variables that you can use to work with the Pulumi CLI, see Environment Variables.

Complete Reference

Below is the complete documentation for all available commands:

Pulumi command line

Synopsis

Pulumi - Modern Infrastructure as Code

To begin working with Pulumi, run the pulumi new command:

$ pulumi new

This will prompt you to create a new project for your cloud and language of choice.

The most common commands from there are:

- pulumi up       : Deploy code and/or resource changes
- pulumi stack    : Manage instances of your project
- pulumi config   : Alter your stack's configuration or secrets
- pulumi destroy  : Tear down your stack's resources entirely

For more information, please visit the project page: https://www.pulumi.com/docs/

Options

      --color string                 Colorize output. Choices are: always, never, raw, auto (default "auto")
  -C, --cwd string                   Run pulumi as if it had been started in another directory
      --disable-integrity-checking   Disable integrity checking of checkpoint files
  -e, --emoji                        Enable emojis in the output
  -h, --help                         help for pulumi
      --logflow                      Flow log settings to child processes (like plugins)
      --logtostderr                  Log to stderr instead of to files
      --non-interactive              Disable interactive mode for all commands
      --profiling string             Emit CPU and memory profiles and an execution trace to '[filename].[pid].{cpu,mem,trace}', respectively
      --tracing file:                Emit tracing to the specified endpoint. Use the file: scheme to write tracing data to a local file
  -v, --verbose int                  Enable verbose logging (e.g., v=3); anything >3 is very verbose

SEE ALSO

Command-line Completion

The Pulumi CLI also has a command to generate a command-line completion script for Bash and Zsh. This gives you tab completion for all commands, sub-commands, and flags, which can make it easier to remember what to type and where.

Bash

To use this, you’ll first need to ensure bash completion is installed:

  • On most current Linux distros, bash completion should be available.
  • On a Mac, install with brew install bash-completion.

The pulumi gen-completion bash command self-generates its own CLI script. You can save the output to a file.

  • On Linux, save to pulumi gen-completion bash > /etc/bash_completion.d/pulumi.
  • On macOS, save to pulumi gen-completion bash > /usr/local/etc/bash_completion.d/pulumi.

Ensure that bash completion is run when you launch a new terminal by adding it to ~/.bash_profile.

On Linux:

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

On macOS:

if [ -f /usr/local/etc/bash_completion ]; then
    . /usr/local/etc/bash_completion
fi

Finally, after saving the pulumi bash completion script, either reopen your terminal or source your profile in order to reload the bash completion scripts in your current terminal session (. ~/.bash_profile).

Zsh

The pulumi gen-completion zsh command self-generates its own CLI script. You can save the output to a file inside a directory listed in the $fpath variable.

You can list your $fpath directories and pick one of them:

echo $fpath

You can also use an arbitrary directory like ~/.zsh/completion/ and then add it to your fpath in ~/.zshrc :

fpath=(~/.zsh/completion $fpath)

Make sure compinit is loaded or do it by adding in ~/.zshrc:

autoload -Uz compinit && compinit -i

Then reload your shell:

exec $SHELL -l

Fish

The pulumi gen-completion fish command self-generates its own CLI script. You can save the output to a file or use it in the current session:

pulumi gen-completion fish | source

To load the completions for each session, you need to save the completion to a file:

pulumi gen-completion fish > ~/.config/fish/completions/pulumi.fish

Finally, after saving the pulumi fish completion script, you need to reopen your terminal for the scripts to take effect.