Your cloud (BYOC)
Connect Google Cloud and create a setup
The checklist, the Cloud Shell script, the roles Diakrin asks for, the errors you can see and the fix for each.
An owner, admin or Technical administrator connects one Google Cloud project by running one pinned command in Google Cloud Shell as an Owner of that project, then creates a setup on it; this page lists what the project must have first and what to do when a step stops.
Before you start
| You supply | Example | Comes from |
|---|---|---|
| The project ID (not the name or number) | acme-apps-prod | Google Cloud console project picker. 6 to 30 lowercase letters, digits or hyphens |
| A person who is Owner of that project | An IT administrator | Google Cloud IAM |
| Billing linked to the project | A billing account | Google Cloud Billing |
| A Diakrin role that can manage infrastructure | Owner, admin or Technical administrator | Settings → Members |
| An account name | Production | You choose it. 1 to 60 characters, unique in your organization |
The region is not a choice today. The console shows us-central1 read-only for every Google Cloud account, and every setup on that account uses it. The region is fixed once creation starts.
Checklist
Each row below has its own section. Everything marked Not checked is something Diakrin does not read; it can only show up as a failed step.
| # | Prerequisite | Needed for | Who checks it today |
|---|---|---|---|
| 1 | Project is active and the ID is right | Connect | The script and the console form |
| 2 | You are Owner of the project | Connect | The script, indirectly: it must be able to read the project |
| 3 | Billing is enabled | Connect | The script (DK_CONNECT_BILLING_DISABLED) |
| 4 | Organization policies allow what the script and setup create | Connect and setup | Not checked |
| 5 | Google Cloud APIs are on | Connect, setup and every app | The script turns them on; the app preparation reads them |
| 6 | Connection is verified | Setup | Diakrin, before anything is created |
| 6b | Access version is up to date | Setup and apps | Diakrin, before anything is created |
| 7 | Quotas have room | Setup | Not checked |
| 8 | Region | Setup | The console |
| 9 | App address (nothing to provide) | Setup | Diakrin server-side; no customer text on failure |
Project is active
What: the project must exist and be ACTIVE, and you type its exact project ID, typed into Cloud → Accounts → Connect Google Cloud. Diakrin does not list your projects; you type the ID.
How to check:
gcloud projects describe <project-id> --format='value(projectId,lifecycleState)'You should see the project ID and ACTIVE. If it prints an error, the ID is wrong or you cannot read the project.
If it is missing or wrong: the script stops with DK_CONNECT_PREREQUISITE ("Project … cannot be read: the project ID is wrong or you are not an Owner of it. Nothing was changed."). Nothing is changed. In the console choose Wrong project? Cancel, then connect the right ID. Diakrin does not check that the project is ACTIVE or where it sits in your organization.
Owner of the project
What: the person running the command in Cloud Shell must be able to enable services, create service accounts and custom roles, edit the project's IAM policy, create a Cloud Run job and create BigQuery datasets. The console states the requirement as "You need Owner of the project". No organization or folder permission is used; every call is scoped to the one project.
How to check:
gcloud projects get-iam-policy <project-id> --flatten='bindings[].members' --filter='bindings.role=roles/owner' --format='value(bindings.members)'You should see your account (user:you@example.com) or a group you belong to. A group membership will not show your own address; ask IT if you are unsure.
If it is missing: the script cannot read the project and stops as in Project is active, or a step fails with DK_CONNECT_STEP_FAILED ("Could not … Run the same command again"). Ask a project Owner to run the command. Diakrin does not test for Owner directly.
Billing
What: the project must be linked to an active billing account. Google needs it to turn on the services Diakrin uses.
How to check:
gcloud billing projects describe <project-id> --format='value(billingEnabled)'You should see True.
If it is missing: the script stops with DK_CONNECT_BILLING_DISABLED: "Billing is not enabled on project <id>. … Link a billing account … then run the same command again. Nothing was changed." Link billing at https://console.cloud.google.com/billing/linkedaccount?project=<project-id> and run the same command again. Only the script checks billing; Diakrin's servers do not.
Organization policies
What: organization policies can refuse something the script or a setup creates. Diakrin does not read any organization policy before it acts; a denial shows up as a failed step, for example CHANGE_SET_FAILED ("Google Cloud could not create a resource. What exists was kept. Try again to continue from there.").
What the script and a setup create, so IT can compare it with the policies on the project:
- Six service accounts and 24 custom roles per connection, with project-level IAM bindings, some of them conditional. Diakrin's identity is added as an external member, so a policy that limits members to your own domain can block it.
- Two BigQuery datasets in the EU location, for cost data. A policy that limits resource locations to other regions can block them.
- A Cloud Run job, a VPC with its own subnets and a private services connection, a Cloud SQL PostgreSQL instance with a private address only, Cloud Storage buckets and a Cloud KMS key ring.
- It removes the
roles/cloudbuild.builds.builderrole from the project's default Cloud Build service account, so that only Diakrin's builds can read their files. This changes your existing IAM on that account. - It removes the
roles/editorrole from the project's default Compute Engine service account (<project-number>-compute@developer.gserviceaccount.com). Google grants that role when the script turns the APIs on, and it can read every app's files, so a setup's final checks refuse it. Anything in the project that runs as that account, such as VMs, Cloud Run services or Cloud Build jobs that use the default identity, loses Editor access. The script prints the command that gives the role back.
How to check which policies apply:
gcloud org-policies list --project=<project-id>You should see the constraints set on the project; policies inherited from the folder or organization are not listed here, so ask your organization administrator for the effective ones. Diakrin has not tested a connection against specific policies, so treat any policy that restricts service account creation, allowed IAM member domains, resource locations or VPC peering as a likely blocker and ask Diakrin before you connect.
If it fails: nothing is rolled back for you, because the script adds Diakrin's access last, so nothing can use a half-done connection. Fix the policy, then run the same command again.
Required APIs
What: the script turns on these 12 APIs for access kit 0.8.13, and never turns one off: config, iam, iamcredentials, cloudresourcemanager, serviceusage, cloudbuild, storage, bigquery, cloudasset, cloudidentity, run and secretmanager (each at <name>.googleapis.com). You do not turn them on by hand. Later steps need more: creating a setup turns on artifactregistry, compute, servicenetworking, sqladmin and cloudkms, and the setup's address needs dns and certificatemanager.
Before an app is prepared, Diakrin reads the state of the six APIs that app kit 0.9.1 needs (artifactregistry, iam, storage, sqladmin, secretmanager, run). It never turns one on; if any is not exactly ENABLED, nothing is applied and the answer is ACCOUNT_ACCESS_UPGRADE_REQUIRED. secretmanager is turned on only by access kit 0.8.9 or later, so a project connected with an older kit fails here.
How to check:
gcloud services list --enabled --project=<project-id> --filter='config.name:secretmanager.googleapis.com OR config.name:run.googleapis.com' --format='value(config.name)'You should see both run.googleapis.com and secretmanager.googleapis.com.
If one is missing: update Diakrin's access. That reruns the script, which turns the APIs on.
Connection is verified
What: before a setup is created, Diakrin must have verified the connection: a read-only check that its service accounts, roles and trust in your project are exactly what the access kit defines, and that Diakrin's Execution account cannot be used by anyone else. The console starts the check as soon as you connect, and Verify repeats it. If Google has not applied the grants yet, Diakrin waits and retries for up to 2 hours, every 5 seconds for the first 15 minutes and every 30 seconds after that.
How to check: Cloud → Accounts shows Connected for the project.
If it is missing: creating a setup answers CONNECTION_VERIFICATION_REQUIRED: "Verify the Google Cloud project connection in Cloud accounts before creating this setup." Choose Verify. A problem found later shows as Needs attention, and a deploy on that account is refused (CLOUD_ACCOUNT_NEEDS_ATTENTION: "This cloud account needs attention. An admin must fix it before you can deploy.") until it is fixed. A connection is rechecked about every 15 minutes where that recheck is turned on; it turns red only after two real failures in a row.
Access update
What: the access kit is the set of service accounts and roles the script creates. A setup needs access kit 0.8.9 or later; the newest published today is 0.8.13. An older kit is refused before anything is created. Per stage, the kits in the repository declare these minimums: runtime and gateway 0.8.9, address zone (domain) 0.8.7, app preparation 0.8.7; the setup refusal uses 0.8.9.
How to check: open Cloud → Accounts. A project that needs an update shows "Diakrin's access in Google Cloud project <id> needs an update".
If it is old: creating a setup answers ACCOUNT_ACCESS_UPGRADE_REQUIRED: "Diakrin's access in this project must be updated first. Update it from Cloud → Accounts, verify the project, then try again." The setup stays an editable draft. Run the update command shown on the account, as an Owner, in Cloud Shell, then choose Verify. Diakrin never updates your project for you and never uses Infrastructure Manager for this.
Account states you can see:
| You see | Meaning |
|---|---|
| "Version <v> of Diakrin's access is available. Your current version keeps working until you update." | An update exists and nothing is wrong |
| "The update has not been applied in the project yet. Run the script, then verify." | You approved the update but the script has not run, or did not finish |
| "can't be updated in place because this project's cost data is outside the EU" | Remove the account and connect the project again |
After you run the command, Google can take up to 5 minutes to apply the permissions. Diakrin keeps checking by itself for up to 2 hours; the account turns Connected without another click.
Quotas
What: a setup creates one VPC network, a private services range, a Cloud SQL instance, a storage bucket and a KMS key ring; the address adds a global static IP, a global external load balancer and a Cloud Run gateway. Diakrin does not read your quotas first. A quota that is full shows up as a failed step at creation (CHANGE_SET_FAILED).
How to check: compare the project's quotas for networks, Cloud SQL instances, static addresses and forwarding rules with what is already used, in IAM & Admin → Quotas in Google Cloud.
If it fails: raise the quota in Google Cloud, then select Try again on the setup. What was created is kept and creation continues from there.
Region
The console offers us-central1 for every account and shows it read-only: "Diakrin supports us-central1 for now. Every setup on this account uses this region." The server also refuses a region that has no reviewed price (COST_VERIFICATION_REQUIRED: "There is no reviewed cost estimate for this configuration and region, so the setup cannot be created."). Of the 43 Cloud Run regions the contract lists, 35 have a reviewed price today.
App address and gateway
What: you provide no DNS zone and no certificate for the default address. Each setup gets its own address, <app>.<label>.p.diakrin.dev. Diakrin owns p.diakrin.dev; it creates a Cloud DNS zone, a Certificate Manager certificate, a global external HTTPS load balancer with one static IP, and a Cloud Run gateway in your project, and delegates the zone from Diakrin's side. Employees sign in with the company login at the gateway. Identity-Aware Proxy is not used. The load balancer and gateway cost roughly 30 to 35 US dollars a month per setup, and that cost is not part of the setup's estimate or ceiling today.
Status: these steps run on Diakrin's servers after the setup is ready, one step at a time, each behind a switch that Diakrin turns on per environment. A failure is not shown in the console today: the setup stays Ready and the app's preview link stays pending. If an app link does not appear after the setup is ready, ask your Diakrin contact. Using your own company domain on a Google Cloud setup is planned, not available.
Connect, step by step
- Open Cloud → Accounts as an owner, admin or Technical administrator and choose Connect Google Cloud.
- Enter the project ID and an account name.
- Copy the command the console shows. It downloads the script from Diakrin's release bucket, checks its SHA-256 and runs it. Run it in Google Cloud Shell as the project's Owner.
- The script asks
Continue? [y/N]. Read what it lists, then answery. - When it prints "Done", go back to the console. The account turns Connected by itself; allow up to 5 minutes. Verify checks it at once.
- Open Cloud → Setups → New setup, choose the account and follow Set up your company cloud.
To remove everything the script made, run the same script with --remove: it removes Diakrin's grants first and keeps the cost datasets if they are not empty.
What Diakrin asks for and why
These are the roles in access kit 0.8.13. Diakrin holds no key: it signs in through a federated identity and impersonates one of these accounts for each task.
| Service account | Who may use it | What it holds and why |
|---|---|---|
| Reader | Diakrin's API, through federation | Read-only roles for checks, status and cost |
| Controller | Diakrin's API, through federation | Starting reviewed changes and reading what they created. It also holds permission to run Cloud Run jobs in the project, including jobs you created. Since 0.8.12 it may act as each app's own runtime account (dk-<app>-run), only that account, so it can run the app's service as the app. Since 0.8.13 it may read the images in the app image repositories (dk-app-*) and in no other repository, because Cloud Run checks that the account creating a service can read its image |
| Execution | Only the Controller, as a second step | Creating the setup's resources. No one at Diakrin holds a token for it, and it can set the IAM policy of Cloud Run services in the project |
| SQL prep | Execution | Preparing database access for apps. It holds no project role |
| Actuator | A fixed Diakrin Cloud Run job, diakrin-identity-actuator-<id> | Attaching each app's own service accounts, including the Controller's right to act as the app's runtime account. It can set the IAM policy of service accounts in the project |
| Gateway | Execution | Serving apps behind the company login. Only run.invoker on services named dk-app-* |
What Diakrin never does:
- It creates no service account key and keeps no key.
- It never grants itself any access to the Execution account.
- It never reads your apps' file storage: the setup's final checks fail with
RUNTIME_FILES_READABLE_BY_DIAKRINif its accounts could read it. - It never turns off an API.
- It never deletes your resources when you disconnect or delete a setup in Diakrin. The one exception is a setup with the app address: deleting the setup first removes the gateway, the DNS delegation, the zone and the certificate it created.
- It does not read organization or folder policy.
If it fails
| Symptom | Cause | Fix |
|---|---|---|
Script: DK_CONNECT_PREREQUISITE "Project … cannot be read" | Wrong project ID or you are not an Owner | Cancel in the console, connect the right ID, run as an Owner |
Script: DK_CONNECT_PREREQUISITE "gcloud is not installed" or "No Google account is signed in" | Not running in Cloud Shell, or no gcloud auth login | Run it in Cloud Shell, or sign in, then run the same command again |
Script: DK_CONNECT_BILLING_DISABLED | Billing is not linked | Link billing, run the same command again |
Script: DK_CONNECT_NAME_TAKEN (exit 5) | A name Diakrin uses already belongs to something else in the project | Nothing was changed; ask Diakrin which names clash, or connect a different project |
Script: DK_CONNECT_DECLINED | No terminal to ask on | Run it in Cloud Shell, or add --yes |
Script: DK_CONNECT_STEP_FAILED | A Google step failed, often a policy or permission | Run the same command again; read Organization policies if it repeats |
| Console: "Diakrin hasn't seen its access yet" after 10 minutes | The command did not end with "Done" | Check the Cloud Shell output for an error code in this table |
Console: "The accounts in your project don't match this connection" (ACCESS_TRUST_MISMATCH) | Wrong project, or the access was reinstalled for another connection | Run the command shown for this connection, in the right project |
Console: "Someone else can act as one of the Diakrin service accounts" (SA_BINDING_TOO_BROAD) | An extra member can impersonate a Diakrin account | Remove the extra members, or run the command again |
Console: "A Diakrin service account has more or fewer roles than the kit grants" (ACCESS_PERMISSIONS_MISMATCH) | Someone edited the roles | Run the command again to restore them |
Console: GCP_PROJECT_ALREADY_CONNECTED | The project is already connected | Open that account, or use Connect another with its own access kit |
Setup: ACCOUNT_ACCESS_UPGRADE_REQUIRED | Access kit older than 0.8.9, or an app API is off | Update Diakrin's access |
Setup: CONNECTION_VERIFICATION_REQUIRED | The project is not verified | Open Cloud → Accounts, choose Verify |
Setup: CLOUD_ACCOUNT_NEEDS_ATTENTION | Two checks in a row found a problem with Diakrin's access | An admin fixes the cause the account page names |
Setup: CHANGE_SET_FAILED | Google refused to create a resource: policy, quota or permission | Fix the cause, then choose Try again; what was created is kept |
Setup: STACK_DRIFTED | The resources in the project are not what the setup expects | Nothing was changed; contact Diakrin support |
Setup: RUNTIME_FILES_READABLE_BY_DIAKRIN | The app files bucket could be read by a public member or a Diakrin account | IT reviews who may read the files bucket in IAM; Diakrin will not change any permission |
Setup: COST_VERIFICATION_REQUIRED | No reviewed price for the region | Use the region the console offers |
| Setup shows Infrastructure ready and not "Ready for apps" | The setup record does not mark apps ready yet | Expected today; see what is shipped |
Next
Continue to Set up your company cloud to create the setup, or compare with Connect AWS and create a setup.