---
title: "Get started"
description: "Import an SSH key, launch an instance that allows SSH, and log in to it, from the console or the API."
---

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

# Get started

This guide launches an Ubuntu instance with a public IPv4 address and logs in to it with SSH.

## Before you start

- **Permissions** on the project: `ComputeFullAccess`, `BlockstoreFullAccess`, `NetworkFullAccess`
  and `FirewallFullAccess`, with `ReadOnlyAccess` or `ImagesReadOnlyAccess`, cover everything here
  (or the root user). See [IAM](/compute/iam#launching).
- **An SSH key pair** on your computer. To make one:

  ```sh
  ssh-keygen -t ed25519 -f ~/.ssh/ezgh -C laptop
  ```

### Console

1. **Import your public key.** Open **Compute**, then **SSH keys**, and choose **Add SSH key**.
Paste the contents of `~/.ssh/ezgh.pub`, or choose the file. The name is filled in from the
key's comment.

2. **Open the launch page.** Choose **Instances**, then **Launch instance**.

3. **Choose what to launch.**
- **Image:** Ubuntu, version 24.04 LTS.
- **Instance type:** a type from the list. **Shared** and **Dedicated** switch between
[CPU families](/compute/instance-types).
- **SSH keys:** check your key.
- **Network & firewall:** check **Public IPv4 address**. Under **Allow SSH from**, keep
**Anywhere**: the console attaches a firewall named `ssh-anywhere` (creating it the first time)
that allows TCP port 22 from any IPv4 or IPv6 address, beside the project's default firewall.
- **Storage:** the root volume's size defaults to 20 GiB, or the image's minimum if that's
larger.

4. **Launch.** Choose **Launch instance**. The instance's page opens while it's **Pending**; it's
ready when its state is **Running**.

5. **Log in.** The instance's page shows its **IPv6 address** and **Public IPv4**. Ubuntu's user is
`ubuntu`:

```sh
ssh -i ~/.ssh/ezgh ubuntu@203.0.113.10
```
### API

Set an [API key](/iam/api-keys) and the organization's and project's UUIDs (on their pages in the
console):

```sh
export EZGH_API_KEY=…  ORG_ID=…  PROJECT_ID=…
export P="v1/organizations/$ORG_ID/projects/$PROJECT_ID"
```

1. **Import your public key** with [ImportSshKey](/compute-api/ImportSshKey/):

```sh
SSH_KEY_ID=$(jq -n --arg key "$(cat ~/.ssh/ezgh.pub)" '{name: "laptop", publicKey: $key}' |
  curl -sS -X POST "https://compute-api.ezghcloud.com/$P/ssh-keys" \
    -H "Authorization: Bearer $EZGH_API_KEY" -H "Content-Type: application/json" -d @- | jq -r .slug)
```

2. **Choose an instance type** from [ListInstanceTypes](/compute-api/ListInstanceTypes/):

```sh
curl -sS "https://compute-api.ezghcloud.com/v1/organizations/$ORG_ID/instance-types" \
  -H "Authorization: Bearer $EZGH_API_KEY" | jq -r '.instanceTypes[] | select(.status == "active") | .name'
export TYPE=…   # one of them
```

3. **Create a firewall that allows SSH** with [CreateFirewall](/firewall-api/CreateFirewall/).
The rules you give replace the default outbound rules, so include those too:

```sh
SSH_FW=$(curl -sS -X POST "https://firewall-api.ezghcloud.com/$P/firewalls" \
  -H "Authorization: Bearer $EZGH_API_KEY" -H "Content-Type: application/json" -d '{
    "name": "ssh-anywhere",
    "rules": [
      { "direction": "inbound", "protocol": "tcp", "ports": { "from": 22, "to": 22 }, "peer": { "cidr": "0.0.0.0/0" } },
      { "direction": "inbound", "protocol": "tcp", "ports": { "from": 22, "to": 22 }, "peer": { "cidr": "::/0" } },
      { "direction": "outbound", "protocol": "all", "peer": { "cidr": "0.0.0.0/0" } },
      { "direction": "outbound", "protocol": "all", "peer": { "cidr": "::/0" } }
    ] }' | jq -r .slug)
```

4. **Launch** with [CreateInstance](/compute-api/CreateInstance/). The primary network
interface gets a public IPv4 address, and leaving out `firewallIds` attaches the project's
default firewall:

```sh
OP=$(curl -sS -X POST "https://compute-api.ezghcloud.com/$P/instances" \
  -H "Authorization: Bearer $EZGH_API_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" -d "{
    \"name\": \"web-1\",
    \"instanceType\": \"$TYPE\",
    \"image\": \"linux/ubuntu:24.04\",
    \"sshKeyIds\": [\"$SSH_KEY_ID\"],
    \"networkInterfaces\": [ { \"ipv4\": true } ]
  }")
INSTANCE=$(echo "$OP" | jq -r .target.id)
```

The answer is `202` with a `CreateInstance` [operation](/compute#operations). Poll the instance
with [GetInstance](/compute-api/GetInstance/) until its `status` is `running`.

5. **Attach the SSH firewall** to the instance's primary interface with
[AttachFirewall](/firewall-api/AttachFirewall/):

```sh
ENI=$(curl -sS "https://compute-api.ezghcloud.com/$P/instances/$INSTANCE" \
  -H "Authorization: Bearer $EZGH_API_KEY" | jq -r .primaryNetworkInterfaceId)
curl -sS -X POST "https://firewall-api.ezghcloud.com/$P/firewalls/$SSH_FW/attachments" \
  -H "Authorization: Bearer $EZGH_API_KEY" -H "Content-Type: application/json" \
  -d "{\"interfaceId\": \"$ENI\"}"
```

6. **Log in.** The interface has the addresses
([GetNetworkInterface](/network-api/GetNetworkInterface/)):

```sh
curl -sS "https://network-api.ezghcloud.com/$P/network-interfaces/$ENI" \
  -H "Authorization: Bearer $EZGH_API_KEY" | jq '{ipv6Address, ipv4: .ipv4Address.address}'
ssh -i ~/.ssh/ezgh ubuntu@203.0.113.10
```
### CLI

The [`ezgh` CLI](/cli) uses your signed-in profile's organization and project, or `--org` and
`--project`.

1. **Import your public key:**

```sh
ezgh compute ssh-keys create laptop --public-key ~/.ssh/ezgh.pub
```

2. **Choose an instance type and a volume type** for the root volume:

```sh
ezgh compute instance-types list
ezgh compute volume-types list
```

3. **Create a firewall that allows SSH.** A new firewall allows all outbound traffic; add inbound
TCP 22 from any IPv4 and IPv6 address:

```sh
ezgh compute firewalls create ssh-anywhere
ezgh compute firewalls rules add ssh-anywhere --direction inbound --protocol tcp --ports 22 --cidr 0.0.0.0/0
ezgh compute firewalls rules add ssh-anywhere --direction inbound --protocol tcp --ports 22 --cidr ::/0
```

4. **Launch** and wait until it's running. The primary interface gets a public IPv4 address and the
project's default firewall:

```sh
ezgh compute instances launch web-1 --instance-type <type> --root-volume-type <volume type> \
  --image linux/ubuntu:24.04 --ssh-key laptop --ipv4 --wait
```

5. **Attach the SSH firewall** to the instance's primary interface:

```sh
ENI=$(ezgh compute instances get web-1 -o json | jq -r .primaryNetworkInterfaceId)
ezgh compute firewalls attachments attach ssh-anywhere "$ENI"
```

6. **Log in** with the interface's addresses:

```sh
ezgh compute network-interfaces get "$ENI"
ssh -i ~/.ssh/ezgh ubuntu@203.0.113.10
```

Each [image](/compute/images) has its own login user. If SSH doesn't connect, check the instance's
[console output](/compute/consoles) for cloud-init's progress.

## Clean up

Terminating the instance deletes its root volume and the network interface and IPv4 address the
launch made. In the console, open the instance and choose **Terminate**; with the API, call
[TerminateInstance](/compute-api/TerminateInstance/); with the CLI, `ezgh compute instances terminate web-1`. The SSH key and the `ssh-anywhere`
firewall stay for your next launch.

Source: https://docs.ezghcloud.com/compute/get-started/index.mdx
