# dflow environments:create

> Create an environment and select it.

Web page: /docs/cli/path/environments-create/

This creates an environment in the current project and selects it. Exit 0 means the API has stored the environment. The Kubernetes namespace, the place the containers will run, is created later, by the first operation that writes into the environment.

```bash
dflow environments:create NAME [--region REGION]
```

## Flags

`--region` is optional. It names a registered cluster region such as `eu`. The platform picks one cluster in that region. `--project` names the project for this command and saves that project together with the new environment. The usual global flags still apply.

## What you see

The terminal prints `name`, `status`, `id`, and `selected`. The new environment is saved. The workspace and the project stay selected. A duplicate name exits 4 and leaves the saved selection unchanged. JSON prints the API body.

## When it fails

Exit 1: a bad name or missing context. Exit 2: auth. Exit 3: the project was not found. Exit 4: an environment with that name already exists. Exit 10: the API could not be reached.
