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

# Neterial CLI

> Command-line interface for Neterial services. Learn how to install, connect clouds, and manage VMs.

Command-line interface for [Neterial](https://neterial.cloud) services.

## Installation

Linux, macOS (brew), and Windows WSL:

```sh theme={null}
curl -sSL https://get.neterial.cloud/cli.sh | bash
```

<Card title="Read Installation Details" href="https://github.com/neterial-cloud/cli/blob/main/INSTALL.md">
  Read INSTALL.md for details and alternative ways to install.
</Card>

## Quick start

```sh theme={null}
# Login
neterial auth login

# Add your SSH key (for git push deployments)
neterial ssh-key add --auto-detect

# Connect your cloud (aws or hcloud)
neterial provider init hcloud

# Create your first VM
neterial infra create vm --cloud hcloud
```

Now you can deploy your apps using `git push` or use your VM as a Kubernetes cluster.

## Authentication

Login to your Neterial account:

```sh theme={null}
neterial auth login
```

Logout:

```sh theme={null}
neterial auth logout
```

## Cloud providers

Check your connected clouds:

```sh theme={null}
neterial provider list
```

<Tabs>
  <Tab title="Connect Hetzner Cloud">
    You need to have a Hetzner Cloud account. If you don't have one yet, you can
    register with **[our referral link](https://hetzner.cloud/?ref=0yqTdglfKp3w)**
    and receive €20 in Hetzner Cloud credits.

    Read [how to create an API token in Hetzner Cloud](/cloud-providers/connect-hetzner-cloud).

    Connect your cloud by adding a Hetzner Cloud API token:

    ```sh theme={null}
    neterial provider init hcloud
    ```
  </Tab>

  <Tab title="Connect AWS">
    Read [how to add AWS credentials](/cloud-providers/connect-aws).

    Connect your cloud by adding AWS credentials:

    ```sh theme={null}
    neterial provider init aws
    ```
  </Tab>
</Tabs>

## SSH keys

Add your SSH public key to enable `git push` deployments.
The `--auto-detect` flag tries to discover your SSH key automatically:

```sh theme={null}
neterial ssh-key add --auto-detect
```

Or specify a key file:

```sh theme={null}
neterial ssh-key add ~/.ssh/id_ed25519.pub
```

List your SSH keys:

```sh theme={null}
neterial ssh-key list
```

Delete an SSH key:

```sh theme={null}
neterial ssh-key delete <key-id>
```

## VMs

### Create VM

Create with default settings:

```sh theme={null}
neterial infra create vm
```

Set name and cloud provider (`hcloud` or `aws`):

```sh theme={null}
neterial infra create vm --name [VM_NAME] --cloud [CLOUD]
```

Set location:

```sh theme={null}
neterial infra create vm --cloud hcloud --location ash
neterial infra create vm --cloud aws --location us-east-1
```

### List VMs

```sh theme={null}
neterial infra get vms
```

### Delete VM

```sh theme={null}
neterial infra delete vm --name [VM_NAME]
```

### VM types

You can choose the VM type when creating to control compute capacity:

```sh theme={null}
neterial infra create vm --name [VM_NAME] --vm-type [VM_TYPE]
```

## Accessing your VM

### Get kubeconfig

Get kubeconfig for the default VM:

```sh theme={null}
neterial infra get kubeconfig
```

Get kubeconfig for a specific VM:

```sh theme={null}
neterial infra get kubeconfig --cluster [VM_NAME]
```

Then access your cluster:

```sh theme={null}
kubectl get nodes
```

### List nodes

View the Kubernetes nodes in your cluster:

```sh theme={null}
neterial infra get nodes --cluster [VM_NAME]
```

## Deploying apps

Deploy your apps using git push. First, add your VM as a git remote:

```sh theme={null}
git remote add neterial git@git.[WORKLOAD_HOSTNAME]:[APP_NAME].git
```

Then push to deploy:

```sh theme={null}
git push neterial main
```

Your app will be available at `https://[APP_NAME].[WORKLOAD_HOSTNAME]`.

Use `neterial infra get workload-hostname` to get your VM's hostname.

## Container registry

Each VM includes a pre-installed container registry for storing your Docker images.

Get container registry credentials:

```sh theme={null}
neterial infra get registry
```

Get registry for a specific VM:

```sh theme={null}
neterial infra get registry --name [VM_NAME]
```

Get credentials and automatically run `docker login`:

```sh theme={null}
neterial infra get registry --docker-login
```

Get only the registry hostname:

```sh theme={null}
neterial infra get registry --hostname
```

## Workload hostname

Each VM has a unique hostname. Your deployed apps are available at subdomains of this hostname, e.g., `https://myapp.[WORKLOAD_HOSTNAME]`.

Get the workload hostname:

```sh theme={null}
neterial infra get workload-hostname --cluster [VM_NAME]
```

## Account

### Delete account

<Warning>
  **Warning: This operation will permanently remove your Neterial account.**
  You will still have access to your VMs, but you will no longer be able to manage them using the Neterial platform.
</Warning>

```sh theme={null}
neterial account delete
```
