Cloud sync
Import cloud VMs into Bast as read-only hosts, starting with Google Cloud.
The Sync tab (3) pulls servers from cloud providers into Bast. Synced hosts show up in the host picker under a provider group, stay connectable with your system ssh, and keep connection details owned by the provider — you do not edit them like Bast-managed hosts.
Today Bast supports GCP. AWS and Azure appear in the provider list as coming soon.
Requirements
- Google Cloud SDK (
gcloud) on yourPATH - At least one authenticated account (
gcloud auth login), and/or a service account JSON key - IAM that can list projects and Compute Engine instances
- For private VMs: IAP TCP forwarding allowed to the instance
Connect GCP
- Open Bast and press
3for Sync. - Select GCP and press Enter.
- Choose Connect or Sync now.
Bast discovers every authenticated gcloud account, lists accessible projects, and imports running Linux instances. Windows guests and stopped VMs are skipped.
Add more Google accounts with the usual CLI:
gcloud auth login
gcloud auth login [email protected]What gets created
Each instance becomes an SSH host Bast writes under:
~/.ssh/bast/sync/gcp/configYour managed Bast config includes that file so OpenSSH (and Bast) can see the hosts. In the picker they are grouped as:
GCP / <project name>
instance-nameDetail shows GCP synced. Connection settings, group, and label are owned by sync — edit (e) and delete (d) are blocked. Favoriting and hiding still work.
How Bast connects
| Situation | Behavior |
|---|---|
| Public IP | Direct SSH to the external address |
| Private only | ProxyCommand via gcloud compute start-iap-tunnel |
ssh-keys metadata | Matches the public key to a local key in ~/.ssh/bast/keys or ~/.ssh, then sets User + IdentityFile |
| No matching key | Falls back to OS Login username, image defaults (ubuntu, debian, …), then ~/.ssh/google_compute_engine when present |
If Auth in the detail panel says the user is unknown, set a Default SSH user in the GCP submenu (or put the right key on the VM).
GCP settings
Inside the GCP submenu:
| Action | Purpose |
|---|---|
| Sync now | Re-run discovery and refresh SSH config |
| Connect / Disconnect | Enable sync, or turn it off and remove generated hosts |
| Enable / Disable auto-sync | Sync when the TUI opens (off by default) |
| Default SSH user | Used when metadata does not imply a user |
| Project filter | Comma-separated project IDs; blank = all accessible |
| Add / Remove service account key | JSON key paths for projects your user login cannot see |
| Refresh status | Reload accounts and last-sync info |
Press Esc to return to the provider list.
CLI
bast sync gcp # discover and write hosts
bast sync status # accounts, last sync, errors
bast sync disable gcp # turn off and remove sync hosts
bast sync gcp --json
bast sync status --jsonRe-sync and cleanup
Press r on the Sync tab (or run bast sync gcp) after you create or delete VMs. Disconnecting GCP removes the generated sync config and the Include line Bast added for it. Your Bast-managed hosts and keys are left alone.