Deploying Portward Enterprise on Google Cloud
Enterprise only. This page is about the Portward gateway that a company runs in its own cloud. If Portward runs it for you, on the web, this page doesn’t apply: see the page for Portward on the web.
This guide is for the person who runs Google Cloud at your company, and takes about 25 minutes. When you finish, your team can ask Claude or ChatGPT about company data through a gateway that runs in your own Google Cloud project. The gateway replaces the values you mark as sensitive with tokens before the AI sees them. It records every answer in your project. Portward, the company, never receives your data and has no access to your project.
The deployment creates these resources, all in your project:
| One machine (e2-small, Container-Optimized OS, Shielded VM) | Runs the gateway, Caddy (its HTTPS certificate) and, with the relay, the relay client. |
| A records disk (10 GB, encrypted) | Holds the gateway’s answer records, setup and saved connections. Snapshotted daily and kept 14 days. Snapshots stay if the disk is deleted. |
| Secret Manager | Holds the gateway key and the secrets you add. The machine generates the key the first time it starts, and the key never leaves your project. |
| A new network | Nothing open inbound. With your own domain, ports 80 and 443 only. |
| A service account | Can read its own secrets, add the key once and write logs. Nothing else. |
The cost is roughly $18 a month in us-central1. That is about $12 for the machine, $2 for the disks, $4 for its IP address, and a few cents for snapshots and secrets.
What you need
Section titled “What you need”- A Google Cloud project, with roles in it that can create the resources above. Owner works, or Compute Admin, Service Account Admin, Service Account User, Project IAM Admin, Secret Manager Admin and Service Usage Admin.
- Terraform 1.5 or later. With the Deploy to Google Cloud button you don’t need it, because Cloud Shell has it.
- Your company directory, where your team already signs in. This can be Microsoft Entra, Okta, Google Workspace or any OpenID Connect directory.
- Your Portward license key (
pwlic_…) from the key page (Get started, step 2). The gateway uses it to download its image and to connect to the relay. The key includes your gateway’s name. - An address. You can use the Portward relay (
https://yourco.gw.portward.ai, from the license key), which opens nothing inbound. You can also use a name of your own, such asportward.yourcompany.com, that you can point at an IP. - Read-only logins for the databases you’ll connect. Portward refuses a login that can write.
1. Register the gateway in your directory (10 minutes)
Section titled “1. Register the gateway in your directory (10 minutes)”Register one web app with the redirect address https://<your address>/auth/callback. Sign-in setup
has the steps for Entra, Okta and Google. Keep the app’s sign-in address (issuer), client id and secret.
2. Deploy (5 minutes, then about 3 for the machine)
Section titled “2. Deploy (5 minutes, then about 3 for the machine)”The quick way. Press Deploy to Google Cloud. The same button is on the page that showed your license key. Cloud Shell opens with this module and a step-by-step tutorial beside it. Google runs repositories it doesn’t maintain in a temporary session. The tutorial has you sign in there and keeps Terraform’s state in a private bucket in your project. It asks for the license key and directory secret without showing them, and never takes them from the link. It runs the same module as below.
Or from your own Terraform:
module "portward" { source = "https://portward-launch.s3.us-east-2.amazonaws.com/templates/1.1.2/gcp/portward-gcp.zip" project_id = "your-project" zone = "us-central1-a"
# Your license key from signing up (pwlic_yourco_...): the image, the relay key and the address, # https://yourco.gw.portward.ai through the Portward relay ... license_key = var.portward_license # e.g. TF_VAR_portward_license from your vault # ... or your own: address_mode = "own-domain" domain = "portward.yourcompany.com"
directory_issuer = "https://login.microsoftonline.com/<tenant id>/v2.0" directory_client_id = "<client id>" admin_groups = ["<group object id>"] # Google Workspace: admin_subjects = ["you@yourco.com"] user_groups = ["<group object id>"] # Google Workspace: users = ["@yourco.com"]}terraform init && terraform applyTo reach databases in an existing network, add subnetwork = "projects/<p>/regions/<r>/subnetworks/<name>". If that
network has no public IP and uses Cloud NAT instead, also add public_ip = false.
If Compute Engine wasn’t turned on in the project before, Google creates a default network when you turn it on.
That network has SSH and RDP open to the internet. The gateway runs in its own network and doesn’t use it. Delete it
if nothing else uses it.
3. Add the directory secret (2 minutes)
Section titled “3. Add the directory secret (2 minutes)”The deployment puts the license key in Secret Manager. The key is also in Terraform’s state, so keep the state
private. The directory secret can stay out of the state, and terraform output secrets_to_add lists the command.
Add the secret from a file, so you don’t type it on a command line:
gcloud secrets versions add portward-directory-secret --project your-project --data-file=directory-secret.txtThe machine checks every 30 seconds and starts the gateway once the secret is there. You can pass it as
directory_client_secret instead.
With your own domain, point it at terraform output ip_address with a DNS A record. Caddy gets the certificate as
soon as the name resolves.
4. Check it
Section titled “4. Check it”The gateway is up about a minute after you add the last secret. Through the relay, allow another minute or two for the certificate.
curl -s https://<your address>/health # {"ok": true, ...}The serial console shows the machine’s progress in lines starting with portward:. Open it with
gcloud compute instances get-serial-port-output portward-gateway. The gateway’s own log is in Cloud Logging
(terraform output logs).
5. Make yourself the admin, connect data, give your team access
Section titled “5. Make yourself the admin, connect data, give your team access”Your settings are the module’s values. If you deployed with your own Terraform, edit the module "portward" block.
If you used the Deploy to Google Cloud button, the Cloud Shell session doesn’t keep your files. Open the tutorial
again with the same project and state bucket, and enter every value in portward.auto.tfvars, including the ones
you’re not changing. Then run terraform apply. It replaces the machine, which means a minute or two of downtime.
The records disk and the key are kept.
- Add the
terraform output admin_connectoraddress in Claude or ChatGPT as a custom connector (Get started, step 7) and sign in. Members ofadmin_groupsand the people inadmin_subjectsare admins. If the gateway refuses you, its log (terraform output logs) names your id in an"admin connector refused"line. Add that id toadmin_subjectsand apply. - Add each database host to
setup_hosts, such as["db.internal.yourcompany.com"], and apply. Object stores, Microsoft 365 and Google Drive don’t use this list. - From the admin connector, set up the connection and choose what the AI may see. See Get started, step 8.
- Say who may use the data connector. List groups in
user_groups, or people inusers. People can be sign-in ids, verified emails, or"@yourcompany.com"for everyone at your domain. Then apply. - Each of them adds the
terraform output data_connectoraddress in Claude or ChatGPT. See Get started, step 9.
Running it
Section titled “Running it”- Changing settings. Edit the module’s values and run
terraform apply, as in step 5. - Updates, backups and restores. See Update and back up. Google Cloud takes a snapshot of the records disk every day. Back up the gateway key once and keep it separate from the snapshots, as that page shows.
- Removing it. The key is protected from deletion. Set
keep_key_on_destroy = falseand runterraform apply, thenterraform destroy. Snapshots are kept until you delete them.
If something’s wrong
Section titled “If something’s wrong”| You see | Fix |
|---|---|
Serial console: waiting for secret ... | Add that secret (step 3). |
Serial console: couldn't pull | The license key is revoked or the license ended. Replace the license key, or write to support@portward.ai about the license. |
/health doesn’t answer over the relay | Check that the license key is current. A reissued key replaces the old one, so update license_key. |
/health doesn’t answer at your domain | DNS doesn’t point at ip_address yet. |
| Sign-in says the redirect address doesn’t match | The directory app’s redirect address must be exactly terraform output redirect_uri. |