1. Docs
  2. Pulumi ESC
  3. Environments
  4. Dynamic environment variables

Running commands with environment variables

    The Pulumi ESC CLI includes a run command that allows you to run commands with Pulumi ESC managed environment variables, without exporting them to your shell.

    You can run esc run using an environment:

    $ esc run <environment-name> <command>
    

    For example, to list your S3 buckets with the AWS CLI using environment variables from the myorg/test environment:

    $ esc run myorg/test aws s3 ls
    2023-10-10 16:09:19 my-s3-bucket
    

    If you need to pass one or more flags to the command, prefix the command with --:

    $ esc run myorg/test -- aws s3 ls s3://my-s3-bucket --recursive --summarize
    ...
    Total Objects: 5087
       Total Size: 2419123156
    

    For additional options and details, see esc run --help.

      PulumiUP 2024. Watch On Demand.