Skip to content
AnchrasDocumentation
Browse documentation

Integrations / User guide

Cloud and infrastructure

Available

Google Cloud

Connect a Google Cloud project to Anchras with a service-account key or keyless workload identity federation.

On this page

Connect a Google Cloud project to Anchras with a service-account key, or keyless through workload identity federation, and manage Compute Engine VMs in it.

Before you begin

Pick the project Anchras should manage and note its project ID (not its display name or number). In that project, create a service account for Anchras and grant it Browser (roles/browser, to register and validate the account) and Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1, which also covers listing VMs for adoption). New VMs created by Anchras have no attached guest service account. Create a JSON key for the service account under IAM & Admin > Service Accounts > Keys and keep the downloaded file safe; it is a long-lived secret. You need permission to manage integrations in the intended Anchras organization.

If your organization enforces iam.disableServiceAccountKeyCreation, you cannot create a key: connect keyless instead (see Keyless: workload identity federation). The service account needs the same roles either way.

Connection settings

SettingWhat to enter
Display nameA recognizable name for this project or environment.
Service-account key (JSON)The full contents of the downloaded key file (its type field is service_account).
Project IDOptional. The project to manage. Leave empty to use the project the key was created in; set it when the service account lives in a different project.
Default regionA Compute Engine region, such as europe-west1 (St. Ghislain, Belgium).

With a key, Anchras accepts only service-account keys. External-account (workload identity federation) configuration files, user and impersonation credential files are rejected, as is a key whose token_uri is not Google's own token endpoint: a configuration file's credential source would read files, fetch URLs or run programs on the control plane. Keyless accounts use the typed settings below instead.

Keyless: workload identity federation

Keyless accounts store no secret. Anchras is an OpenID Connect issuer: for each operation it signs a five-minute token for the one cloud account, Google's Security Token Service exchanges it at your workload identity pool provider, and the federated identity impersonates your service account. The token's subject names your organization and the cloud account, so a provider you configure for one account accepts no other account's tokens.

SettingWhat to enter
Credential typeKeyless (workload identity).
Project IDRequired. The project to manage.
Workload identity providerThe provider's full resource name, projects/<number>/locations/global/workloadIdentityPools/<pool>/providers/<provider> (the project number, not its ID).
Service account emailThe service account Anchras acts as, with the roles listed above.

The connection form (or anchras cloud-accounts workload-identity-setup --provider gcp) shows the values to configure in Google Cloud and reserves the account's ID. In the project that holds the pool:

  1. Create a workload identity pool, then add an OpenID Connect provider to it:
  2. Issuer (URL): the issuer URL Anchras shows, ending in /workload-identity. Google fetches <issuer>/.well-known/openid-configuration and <issuer>/jwks.json from it, so it must be reachable over public HTTPS, unless you upload the JWKS instead (see Private and air-gapped installations).
  3. Audiences: leave the default audience. Anchras's tokens carry https://iam.googleapis.com/<provider resource name>, which the setup shows as the allowed audience.
  4. Attribute mapping: google.subject=assertion.sub,attribute.org_id=assertion.org_id,attribute.cloud_account_id=assertion.cloud_account_id.
  5. Attribute condition: the assertion.sub == "org:…:cloud-account:…" condition Anchras shows. It admits only this account's tokens.
  6. On the service account, grant Workload Identity User (roles/iam.workloadIdentityUser) to the principal Anchras shows (principal://iam.googleapis.com/projects/<number>/locations/global/workloadIdentityPools/<pool>/subject/org:…).
  7. Save the account in Anchras with the same setup (the form carries the reserved ID; the CLI takes --account-id). Validation runs the full exchange and reads the project.
bash
anchras cloud-accounts workload-identity-setup --provider gcp \
  --gcp-workload-identity-provider projects/123456789012/locations/global/workloadIdentityPools/anchras/providers/anchras
anchras cloud-accounts create --region eu-west --provider gcp --display-name smals-research --default-region europe-west1 \
  --account-id <account_id> --gcp-project-id smals-research \
  --gcp-workload-identity-provider projects/123456789012/locations/global/workloadIdentityPools/anchras/providers/anchras \
  --gcp-service-account anchras@smals-research.iam.gserviceaccount.com

Anchras rotates its signing keys monthly. A new key is published a day before it signs and the old one stays published for a day after, so Google never sees an unknown key.

Private and air-gapped installations

If Google cannot reach your issuer URL, the provider can hold an uploaded copy of the JWKS instead, and Anchras keeps that copy up to date:

  1. Export the issuer's keys: anchras cloud-accounts workload-identity-jwks --out-dir ./anchras-issuer writes jwks.json (and the discovery document), as does Download JWKS / discovery document in the dashboard. Upload jwks.json as the provider's JWKS file (Upload JWKS file in the console, or gcloud iam workload-identity-pools providers update-oidc … --jwk-json-path ./anchras-issuer/jwks.json). The issuer URL stays the one Anchras shows.
  2. Grant the service account iam.workloadIdentityPoolProviders.update on the provider, for example with a custom role on the pool's project. Anchras pushes the keys as that service account.
  3. Create the account in uploaded-JWKS mode: --gcp-jwks-upload on anchras cloud-accounts create or rotate, or Private issuer: upload JWKS to the WIF provider in the dashboard's keyless form.

Anchras checks every hour whether the provider holds the keys it publishes. When a new key is published, a day before it signs, Anchras uploads the new JWKS to the provider. The account shows when the keys were last pushed (anchras cloud-accounts get, or JWKS push on the account in the dashboard, which also shows a pending rotation's successor key and when it activates), and a failed push shows its error class (auth, network, not_found, …) until the next hourly attempt succeeds. If no push succeeds before the new key signs, Google refuses the account's tokens: upload the JWKS from workload-identity-jwks by hand, and fix the permission so the next rotation is pushed again. Without --gcp-jwks-upload, Anchras pushes nothing and Google fetches the keys from the issuer URL.

Connect to Anchras

  1. Open Google Cloud in the console and start the cloud account connection.
  2. Paste the key JSON and, if needed, the project ID. Select a default region.
  3. Save the account and inspect credential validation. Anchras exchanges the key for a short-lived access token and reads the project from Cloud Resource Manager.

You can also connect from the CLI:

bash
anchras cloud-accounts create --region eu-west --provider gcp --display-name smals-research --default-region europe-west1 --gcp-service-account-key-file ./key.json --gcp-project-id smals-research

Verify the connection

The account shows the project ID as its external identity and the project's display name. Validation reads only project metadata, so it is free and changes nothing in the project.

Availability and limits

Available integration. Anchras can create, observe, start, stop, reset and delete Compute Engine VMs in the connected project. Live qualification on October 10, 2026 covered an e2-standard-2 in europe-west1-b, Ubuntu 24.04 and a 10 GiB auto-delete boot disk: provision, agent enrollment, stop/start with heartbeat recovery, provider address refresh, termination and zero VM/disk/reserved-IP residue. A separate VM passed observe-only dashboard import and release with its native identity, disk, addresses and metadata unchanged. The qualification record retains the tested release and scope. Other machine types, zones, reset and keyless credentials were not exercised by this qualification.

  • Instances are zonal: the provider region is a zone such as europe-west1-b.
  • New VMs boot the current Ubuntu 24.04 LTS image, attach to the project's default network with an external IP (needed to enrol without Cloud NAT), and receive cloud-init through the user-data metadata key (256 KiB limit).
  • New VMs are ordered from a priced offer: an E2, N2 or N4 predefined machine type (standard, highmem or highcpu, up to 32 vCPUs) in a zone of europe-west1, europe-west3, europe-west4, europe-north1, us-east1, us-central1 or us-west1. Offers appear in the marketplace once the operator configures the Compute Engine price feed (Google's Cloud Billing Catalog, on-demand list prices in EUR, before sustained- or committed-use discounts); without it Google Cloud lists no offers. From the CLI: anchras instances provision --name gce-1 --connection-id <account-id> --provider-sku e2-standard-2 --provider-region europe-west1-b. Not every series runs in every zone, so a machine type is offered only in the zones Compute Engine reports it available in; a zone whose availability could not be checked lists no offers until the next successful price sync.
  • VMs that already run in the project can be imported through Instances > Import VMs, or adopted from the CLI or API (anchras instances adoptable / adopt). Adopted VMs are observed and can be powered, but Anchras never deletes them: release one to stop managing it. Import and release leave the native VM unchanged; agent enrollment is a separate action. VMs in regions outside Europe and the US are listed but cannot be adopted yet.
  • Projects that delete the default network or forbid external IPs (constraints/compute.vmExternalIpAccess) are not supported for new VMs yet.

Google is a US company, so Anchras scores Google Cloud workloads as non-EU jurisdiction even in European regions.

Troubleshooting

  • Authentication failed / token exchange rejected the key: the key was deleted or disabled, or the service account was removed. Create a new key and rotate it in Anchras.
  • Security Token Service rejected the Anchras token (keyless): the provider's issuer URL, audience or attribute condition does not match what the setup shows, or Google cannot reach the issuer URL over HTTPS. Compare the provider with anchras cloud-accounts workload-identity-setup --account-id <id>.
  • Impersonating the service account was refused (keyless): the principal lacks Workload Identity User on the service account, or the email is wrong.
  • Status 403 on the project: the service account lacks resourcemanager.projects.get on the project. Grant the Browser role.
  • Status 404: the project ID is wrong, or the service account cannot see the project.
  • Insert fails with a network or external IP error: the project has no default network, or an organization policy forbids external IPs.
  • Project is not active: the project is pending deletion. Restore it or connect another project.

Operate and disconnect

Rotate keys through the protected account configuration, revalidate, then delete the old key in Google Cloud. You can also rotate a key-based account to keyless: configure the provider for the account's existing ID, then rotate its credentials to the keyless settings. Before removing the connection, identify workloads that depend on it. Disconnecting an account does not delete resources in the project or the key in Google Cloud.