ClickHouse CLI

[Edit this page](https://github.com/ClickHouse/clickhouse-docs/blob/main/docs/cloud/features/02b_cli.md)

The ClickHouse CLI (`clickhousectl`) is a unified command-line tool for managing ClickHouse Cloud resources and local development with ClickHouse.

## Installation[​](#installation "Direct link to Installation")

```
curl https://clickhouse.com/cli | sh
```

A `chctl` alias is also created automatically for convenience.

## Cloud management[​](#cloud-management "Direct link to Cloud management")

Authenticate with ClickHouse Cloud and manage your services directly from the command line.

### Authentication[​](#authentication "Direct link to Authentication")

```
clickhousectl cloud auth
```

This prompts for your API key and secret, and saves them to `.clickhouse/credentials.json` (project-local, git-ignored).

You can also use environment variables:

```
export CLICKHOUSE_CLOUD_API_KEY=your-key
export CLICKHOUSE_CLOUD_API_SECRET=your-secret
```

### Services[​](#services "Direct link to Services")

```
# List services
clickhousectl cloud service list

# Create a service
clickhousectl cloud service create --name my-service \
  --provider aws \
  --region us-east-1

# Get service details
clickhousectl cloud service get <service-id>

# Scale a service
clickhousectl cloud service scale <service-id> \
  --min-replica-memory-gb 24 \
  --max-replica-memory-gb 48 \
  --num-replicas 3

# Start/stop a service
clickhousectl cloud service start <service-id>
clickhousectl cloud service stop <service-id>

# Delete a service
clickhousectl cloud service delete <service-id>
```

### Organizations[​](#organizations "Direct link to Organizations")

```
clickhousectl cloud org list
clickhousectl cloud org get <org-id>
```

### API keys[​](#api-keys "Direct link to API keys")

```
clickhousectl cloud key list
clickhousectl cloud key create --name ci-key --role-id <role-id>
clickhousectl cloud key delete <key-id>
```

### Members and invitations[​](#members-and-invitations "Direct link to Members and invitations")

```
clickhousectl cloud member list
clickhousectl cloud invitation create --email [email protected] --role-id <role-id>
```

### Backups[​](#backups "Direct link to Backups")

```
clickhousectl cloud backup list <service-id>
clickhousectl cloud backup get <service-id> <backup-id>
```

### JSON output[​](#json-output "Direct link to JSON output")

Use the `--json` flag to get JSON-formatted responses from any cloud command:

```
clickhousectl cloud --json service list
```

## Local development[​](#local-development "Direct link to Local development")

The CLI also manages local ClickHouse installations and servers. See the [quick install](/docs/install/quick-install) page for getting started with local development.

## Requirements[​](#requirements "Direct link to Requirements")

- macOS (aarch64, x86\_64) or Linux (aarch64, x86\_64)
- Cloud commands require a [ClickHouse Cloud API key](/docs/cloud/manage/openapi)

- [Installation](#installation)- [Cloud management](#cloud-management)
    - [Authentication](#authentication)- [Services](#services)- [Organizations](#organizations)- [API keys](#api-keys)- [Members and invitations](#members-and-invitations)- [Backups](#backups)- [JSON output](#json-output)- [Local development](#local-development)- [Requirements](#requirements)

Was this page helpful?