# Google Cloud

> Add Compute Engine VMs by hand or have every new VM join at boot with a startup script.

Compute Engine VMs join like any [Linux server](/devices/linux). You don't need an external IP or firewall rules: Underpass connects outward, and falls back to a relay if a direct path isn't possible.

## Get a key

In the dashboard, open **Machines → Add device → Google Cloud** and generate a key. VMs are tagged `tag:gcp`, so access rules can target them, and they never expire.

Make the key **reusable** if several VMs, or VMs you recreate, will use it.

## One VM

SSH into the VM (for example with **SSH** in the console) and paste the setup script from the dashboard:

```bash
curl -fsSL https://coord.getunderpass.com/download/install.sh | UNDERPASS_AUTH_KEY=tskey-auth-xxxxxxxxxxxx sh
```

## Every new VM, at boot

Add a startup script so VMs join on their own. In the console: **Edit VM → Automation → Startup script**, or set the `startup-script` metadata key:

```bash
#!/bin/sh
# Join Underpass once; later boots find it installed.
command -v underpass >/dev/null || \
  curl -fsSL https://coord.getunderpass.com/download/install.sh | UNDERPASS_AUTH_KEY=tskey-auth-xxxxxxxxxxxx sh
```

With `gcloud`:

```bash
gcloud compute instances create my-vm --metadata-from-file=startup-script=join-underpass.sh
```

Use a reusable key here, and an **ephemeral** one for VMs in managed instance groups that come and go: they're removed after 10 minutes offline.

> [!NOTE]
> Startup scripts are readable by anyone who can see the VM's metadata. Keep the key's expiry short, or store it in Secret Manager and fetch it in the script.

## Next

- [Access controls](/features/access-controls) for `tag:gcp`
- [Subnet routes](/features/subnet-routes) to reach a whole VPC through one VM
