> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bqto.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Bastion settings

> Change the bastion of a bqto session with --duration, --zone and --network, and with bqto Pro, --spot, --subnet, --machine-type and --image for restricted organizations.

## Settings in every bqto

| Flag | What it does |
| - | - |
| `--duration` | The lifetime of the VM. The default is `30m`. Compute Engine deletes the VM at the end, even if bqto was killed |
| `--zone` | The zone of the bastion. Without it, bqto picks a zone in the region. If that zone is out of capacity, bqto tries another zone |
| `--network` | Puts the bastion on another VPC than the one of the instance. It takes a name, or `projects/HOST/global/networks/NAME` when the VPC lives in another project (Shared VPC) |
| `-p` | The local port |

The free bqto puts the bastion in a subnet of the VPC network and region of the service. It picks
the first subnet, in name order, that can host a VM. It has no flag to pick another subnet.

## Settings in bqto Pro

> [!NOTE]
>
> `--spot`, `--subnet`, `--machine-type`, and `--image` need bqto Pro.

These flags change the bastion of one session, and a [profile](https://docs.bqto.dev/guides/profiles-and-stacks.md) can
hold them:

```sh theme={null}
bqto connect --project my-project --service cloudsql --instance sql-main --spot
bqto connect --project my-project --service cloudsql --instance sql-main \
  --subnet my-subnet --machine-type e2-small
```

| Flag | What it does |
| - | - |
| `--spot` | Makes the bastion a Spot VM, which is cheaper and can be preempted |
| `--subnet` | The subnet of the bastion. It takes the short name or the self-link of a subnet |
| `--machine-type` | The machine type of the bastion. The default is `e2-micro` |
| `--image` | The image of the bastion, for organizations that allow only approved image projects |

Without `--subnet`, bqto Pro uses the subnet that the service names. Cloud Run with Direct VPC
egress set by subnet names one, and so does Managed Kafka. For Cloud Run, it takes the first subnet with Private
Google Access. Otherwise, it takes the same subnet as the free bqto.

[Costs](https://docs.bqto.dev/reference/costs.md) shows what a bastion costs, with and without `--spot`.

## Organizations that restrict what a VM may be

Some organization policies reject the bastion as bqto creates it. bqto then prints the constraint
that refused the bastion, and where the constraint is set. You can pass both to your platform team.

If your organization allows only approved image projects, pass an image from one of them:

```sh theme={null}
bqto connect --project my-project --service cloudsql --instance sql-main \
  --image projects/HOST/global/images/family/FAMILY
```

The image that you give with `--image` must support OS Login certificates. This support needs
OpenSSH 7.4 or later. For example, SLES 12 images do not support OS Login certificates. If the
image does not support them, the tunnel fails with `Permission denied (publickey)`.

If the image lives in a project of your own, you need `roles/compute.imageUser` on that project.
The default Debian image is public and needs nothing.

bqto cannot meet a policy that requires CMEK (customer-managed encryption keys) or disallows global
DNS. In that case, the fix that bqto prints asks for an exception.

[Security](https://docs.bqto.dev/reference/security.md#the-bastion) says what the bastion is.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.