Bast
Sync

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 your PATH
  • 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

  1. Open Bast and press 3 for Sync.
  2. Select GCP and press Enter.
  3. 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/config

Your 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-name

Detail 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

SituationBehavior
Public IPDirect SSH to the external address
Private onlyProxyCommand via gcloud compute start-iap-tunnel
ssh-keys metadataMatches the public key to a local key in ~/.ssh/bast/keys or ~/.ssh, then sets User + IdentityFile
No matching keyFalls 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:

ActionPurpose
Sync nowRe-run discovery and refresh SSH config
Connect / DisconnectEnable sync, or turn it off and remove generated hosts
Enable / Disable auto-syncSync when the TUI opens (off by default)
Default SSH userUsed when metadata does not imply a user
Project filterComma-separated project IDs; blank = all accessible
Add / Remove service account keyJSON key paths for projects your user login cannot see
Refresh statusReload 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 --json

Re-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.

On this page