Skip to main content

No prompts

When stdin is not a terminal, or with --output json, bqto does not prompt. It acts as if you gave --no-input: a missing value is an error.

Run one command through the session

With -- CMD, bqto runs the command once the tunnel is up. When the command exits, bqto ends the session and deletes the bastion.
The command gets the address of the session in its environment: If the default port is taken, bqto uses the next free one. So two jobs on one host can run at the same time. Always read the port from the environment. bqto passes its stdin to the command. To pass a long query, use stdin or a file, not nested quotes.

A longer session

With --output json, bqto prints one JSON object for each service on stdout once the tunnel is up:
  • Use host and port. remote is the address of the service.
  • tls: true means that your client must use TLS.
  • auth says which credential the service takes: password (an AUTH string) or iam (an access token).
A script can start bqto in the background, read the line, and stop bqto with SIGINT or SIGTERM when the script is done. bqto then deletes the bastion. The bastion deletes itself at expires in any case.

When a program starts bqto

A program that starts bqto, such as a menu bar app, can die without a signal. With --end-on-stdin-close, bqto ends the session and deletes the bastion when its stdin closes. The program keeps a pipe to the stdin of bqto open and never writes to it:
The flag never prompts. It refuses a terminal on stdin, and you cannot use it with -- CMD.

Exit codes

With -- CMD, a code alone does not say whether bqto or the command failed. Look for the error: line of bqto on stderr first.

In CI

  • In GitHub Actions, use bqto-action.
  • On GitLab CI, Cloud Build, Jenkins, and other CI systems, install bqto and run bqto connect --no-input ... -- CMD.
  • In CI, run bqto where no one else shares the machine. Security explains why.
  • With bqto Pro in CI, pass the key in BQTO_LICENSE_KEY. See License key.