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

# aptible db:tunnel

This command creates [Database Tunnels](/docs/core-concepts/managed-databases/connecting-databases/database-tunnels). If your [Database](/docs/core-concepts/managed-databases/overview) exposes multiple [Database Credentials](/docs/core-concepts/managed-databases/connecting-databases/database-credentials), you can specify which one you'd like to tunnel to.

## Synopsis

```
Usage:
  aptible db:tunnel HANDLE [flags]

Flags:
  -e, --env string           Environment handle (alias)
      --environment string   Environment handle
      --port int32           Local port (0 = auto-select)
      --type string          Credential type (defaults to the default credential)
```

# Examples

To tunnel using your Database's default Database Credential:

```shell theme={null}
aptible db:tunnel "$DB_HANDLE"
```

To tunnel using a specific Database Credential:

```shell theme={null}
aptible db:tunnel "$DB_HANDLE" --type "$CREDENTIAL_TYPE"
```
