Skip to main content
At the end of this page, a database client on your laptop talks to a private Cloud SQL instance through bqto.

Before you start

  • bqto is installed. See Install.
  • The target service has a private IP, through private services access (PSA) or Private Service Connect (PSC). bqto refuses a target service that has only a public IP.
  • The region and VPC network of the target service have a subnet where a VM can run.
1

Sign in to Google Cloud

Both logins must use the same account. bqto checks this.
2

Enable the APIs

Enable these APIs in the project of the target service:
For AlloyDB, replace sqladmin.googleapis.com with alloydb.googleapis.com. For Redis, use redis.googleapis.com. For Valkey, use memorystore.googleapis.com.
3

Allow IAP to reach the bastion

The VPC network of the target service needs a firewall rule or policy that allows ingress on tcp:22 from 35.235.240.0/20, the IAP range. bqto checks for this rule, but does not create it. A network admin can create one:
4

Get the roles

Ask an admin for these roles:If you use roles/editor instead of these roles, add roles/iap.tunnelResourceAccessor as well. Permissions has every role, a minimal custom role, and the commands to grant them.
5

Connect

Replace my-project and my-db with your project ID and your instance. Without flags, bqto starts a wizard. The wizard asks for the project, the service, the instance, and the session duration.bqto connect -h lists every flag. bqto help lists the commands.

What you see

Wait for the ready: line before you connect. Then use the local port that it prints. The try: line gives a command for the client of the service. If the default port is taken, bqto says so and uses the next one. So read the number from ready:. If you ask for a port with -p, bqto does not move it. If that port is taken, bqto stops before it creates the bastion. To end the session, press Ctrl-C. bqto deletes the bastion.

How long a session lasts

--duration sets the lifetime of the VM. The default is 30m, counted from when the VM starts. The tunnel takes a minute or two to open, so the time that you can use is a little shorter. The ready: line shows when the session ends. bqto warns you 5 minutes before the end. The tunnel can drop in these cases:
  • The laptop sleeps.
  • The network changes.
  • IAP closes the session.
If the VM is still running and the session still has time, bqto opens the tunnel again to the same bastion. bqto stops after five attempts in a row, or as soon as the bastion is gone.

When something fails

When a check or the tunnel fails, bqto prints the cause and a Fix: line. Troubleshooting matches each tunnel error to its fix.

Next steps

Scripts and CI

Run a command through the tunnel, or read the session as JSON.

Coding agents

Let Claude Code, Codex, or Cursor open a session.