Skip to main content

env zero CLI

The env zero CLI provides a command-line interface for managing your cloud environments and deployments directly from your local machine. This guide walks you through installing, configuring, and using the CLI to build custom workflows while maintaining all the governance and visibility that env zero provides.

Prerequisites

Before you begin, ensure you have:
  • Node.js installed on your local machine
  • An env zero account with appropriate permissions
  • Access to create API keys in your organization

Step 1: Install the CLI

Install the env zero CLI globally using npm or yarn:
npm install -g @env0/cli
Verify the installation by checking the version:
env0 --version

Step 2: Create API credentials

Navigate to your env zero organization settings to create API credentials:
  1. Go to OrganizationSettingsAPI Keys
  2. Click Add API Key
  3. Enter a descriptive name for your key
  4. Copy and save both the API Key ID and secret
Save your API Key ID and secret immediately - the secret will not be available after you close this window.

Step 3: Configure the CLI

Configure the CLI with your credentials and organization details:
env0 configure
The CLI will prompt you for:
  • API Key ID
  • API Key Secret
  • Organization ID
  • Project ID (optional)
  • Blueprint ID (optional)
If you don’t know your organization, project, or blueprint IDs, you can find them in the env0 UI. The CLI will help you discover these values during configuration.

Step 4: Deploy your first environment

Deploy an environment using the CLI:
env0 deploy
The CLI will show real-time deployment logs with organized steps including:
  • Git clone
  • Terraform init
  • Terraform plan
  • Terraform apply

Step 5: Use approval workflows

For deployments that require approval, use the -a flag:
env0 deploy -a
The deployment will pause and wait for approval. You can approve or cancel using:
env0 approve

Step 6: Destroy environments

Destroy environments when they’re no longer needed:
env0 destroy

Advanced usage

The env zero CLI supports many additional commands and options. For complete documentation including:
  • All available commands and flags
  • Advanced configuration options
  • Integration examples
  • Troubleshooting guides
Visit our comprehensive guide:

Complete env zero CLI documentation

Read the full blog post with detailed command reference, advanced examples, and workflow demonstrations.

Next steps

I