Skip to main content
This needs bqto Pro.
A profile saves a target: the project, the service, and the instance. A stack groups several profiles, and opens them all in one session, through one bastion.

A first stack

Replace P with your project ID, and orders and cache with your instances.
  1. The first line connects to the Cloud SQL instance orders and saves the session as the profile db. Ctrl-C ends it.
  2. The second line saves the Redis instance cache as a profile, without connecting.
  3. bqto connect db opens one profile by name.
  4. The next two lines group both profiles in the stack work, and open them in one session, through one bastion.
  5. The last two lines rename the profile cache to sessions, and the stack work to checkout. A stack that lists a renamed profile lists the new name in the same place.
bqto profile -h and bqto stack -h show the help, with examples.

Profiles

A profile stores the identity of a target: the project, the service, and the instance. It never stores the private IP of the service. bqto looks up the IP again on every connect, because PSC endpoints change, and an old IP fails much later in a confusing way.
A profile holds no secrets. Authentication is ADC and IAM, so there is nothing to store.
  • bqto profile create saves a profile without connecting.
  • --save on a bqto connect saves the session that you are already running.
  • bqto connect --service NAME stays as it was: one service, nothing saved.
  • bqto profile list --output json lists the saved profiles as JSON.
  • bqto profile rm NAME removes a profile.
  • bqto profile rename OLD NEW renames a profile. In the same write, bqto also updates every stack that lists it.
  • bqto stack rename OLD NEW renames a stack.
A rename refuses a new name that is already taken.

Names that are taken

If a name is already saved, bqto refuses it before it creates anything, with exit code 2. To overwrite it, add --replace to bqto profile create, bqto stack create, or bqto connect --save. bqto then prints the profile or stack that it replaced.

Where profiles live

bqto stores profiles and stacks in config.toml, in the bqto config folder: To remove all profiles, delete the file.

Several services at once

An application talks to its database, its cache, and its queue. Three sessions mean three bastions and three terminals. Profiles and stacks put them in one session:

Rules for a stack

  • Every service must be on the same VPC, because a session is one bastion. If two services are on different VPCs, bqto says which two before it creates anything.
  • A stack can have services in different regions. bqto warns about it. bqto creates the bastion in the region of the first service in the stack. It also asks that region for everything that the session needs from a subnet.
  • This matters for Cloud Run, because Cloud Run needs Private Google Access on the subnet of the bastion. Put first a service whose region has Private Google Access, or turn it on as Cloud Run shows.
  • --service, --instance, --endpoint, -p, --web, --save, and -- CMD describe a single target. They do not apply to a stack, which takes them from each profile.
  • bqto checks every profile in the stack before it creates anything.
One session has one bastion. So these settings come from the first profile: duration, spot, zone, subnet, machine_type, image, and web. bqto warns when a later profile sets them differently. bqto creates the bastion in the project of the first profile. It looks up the service of each profile in its own project, so a stack can span projects on a Shared VPC. bqto checks Private Google Access when any profile is Cloud Run.

In CI and in the Mac app

  • In GitHub Actions, bqto-action reads profiles and stacks from a config.toml in your repository. See GitHub Actions.
  • The Mac app lists, creates, edits, and opens your profiles and stacks.