Skip to main content
Pulumi logo Pulumi logo
  1. Docs
  2. Deployments & Workflows
  3. Concepts
  4. Deployments Settings
  5. Pre-run Commands

Pre-run Commands

    Pre-run commands allow you to execute arbitrary shell commands before the deployment process starts. This is useful for environment setup, authentication with private package repositories, or other preparatory work. Note that each line of your pre-run command runs in a separate shell.

    For example, you might use pre-run commands to:

    • Install additional dependencies
    • Configure authentication for private repositories
    • Generate configuration files
    • Set up environment variables - see PULUMI_ENV if you need to persist these to your Pulumi program.

    Pulumi ESC environments that you reference in your Pulumi stack’s configuration are not available when pre-run commands are executed, but you can use any environment with pre-run commands by prefixing each command with pulumi env run. For example:

    pulumi env run aws-creds/prod -- aws s3 ls
    

    This executes the aws s3 ls command with credentials from your aws-creds/prod ESC environment. See the Pulumi CLI documentation for more details.

      The infrastructure as code platform for any cloud.