> ## Documentation Index
> Fetch the complete documentation index at: https://astronomer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# astro env connection create

> Create an Environment Manager Airflow connection.

<Info>
  This command is only available on Astro.
</Info>

Create an Airflow connection managed through the Astro Environment Manager. You can scope the connection to a Workspace or a Deployment.

## Usage

```bash wrap theme={null}
astro env connection create
```

## Options

| Option | Description | Possible Values |
| - | - | - |
| `-k`,`--key` | The connection key. Required. | Any string |
| `-t`,`--type` | The connection type, for example `postgres` or `http`. | Any valid Airflow connection type |
| `--host` | The connection host. | Any string |
| `-l`,`--login` | The connection login or username. | Any string |
| `-p`,`--password` | The connection password. If omitted alongside `--type`, the CLI reads it from stdin when piped, or prompts for it with the input hidden. | Any string |
| `--port` | The connection port. | Any valid port number |
| `--schema` | The connection schema. | Any string |
| `--extra` | Extra configuration, defined as a stringified JSON object. | A stringified JSON object |
| `--auto-link` | Workspace scope only. Automatically link the connection to all Deployments in the Workspace, including future ones. | None |
| `--workspace-id` | Set the Workspace scope. Mutually exclusive with `--deployment-id`. Defaults to your current Workspace from CLI context. | Any valid Workspace ID |
| `--deployment-id` | Set the Deployment scope. Mutually exclusive with `--workspace-id`. | Any valid Deployment ID |

## Examples

```bash wrap theme={null}
# Create a Postgres connection scoped to a Workspace
astro env connection create --workspace-id <workspace-id> --key db_main --type postgres --host db.example.com --port 5432 --login admin

# Create a Workspace connection auto-linked to every Deployment, reading the password from stdin
echo "$DB_PASSWORD" | astro env connection create --workspace-id <workspace-id> --key db_main --type postgres --host db.example.com --port 5432 --login admin --schema public --auto-link
```

## Related commands

* [`astro env connection update`](/docs/cli/v1.46/astro-env-connection-update)
* [`astro env connection list`](/docs/cli/v1.46/astro-env-connection-list)
* [`astro env connection delete`](/docs/cli/v1.46/astro-env-connection-delete)
