Prerequisites
- A GCP project with IAM administrator access.
- Permission to create service accounts and assign IAM roles in the project.
- The Google Cloud Console accessible in your browser.
A viewer-level service account is sufficient for cost analysis, security audits, and resource inspection. Widen the roles only if you need write capabilities.
Setup
Create a service account
In the Google Cloud Console, select your project and navigate to IAM & Admin → Service accounts. Click Create Service Account and enter:
- Name:
cloudthinker-readonly - Description: Read-only access for CloudThinker monitoring
Assign roles
Grant the required viewer roles:
Viewer(basic read access)Monitoring Viewer(for monitoring data)Security Reviewer(for security analysis)
Generate a JSON key
Click on the created service account from the list, go to Keys tab → Add key → Create new key, select JSON format, and click Create. Download the key file and store it securely.
Multi-project setup
For organizations with multiple GCP projects:Grant organization-level access
Grant the service account roles at the organization or folder level so it can reach all target projects.
Connection details
| Field | Description | Example |
|---|---|---|
| Service Account Key (JSON) | Full GCP service-account key JSON, uploaded or pasted into the connection dialog | {"type": "service_account", "project_id": "your-project-id", ...} |
Required permissions
Minimum (read-only analysis)
Recommended (full analysis)
Agent capabilities
Once connected, agents can analyze and optimize your GCP resources.| Agent | GCP capabilities |
|---|---|
| Alex | Cost analysis, VM right-sizing, committed use recommendations, resource optimization |
| Oliver | Security Command Center findings, IAM audits, compliance checks |
| Tony | Cloud SQL performance, BigQuery optimization, Spanner tuning |
| Kai | GKE cluster management, workload optimization, Autopilot analysis |
Verify the connection
Example prompts
Troubleshooting
Permission denied errors
Permission denied errors
Verify the service account has the required roles. Check project-level IAM bindings, ensure APIs are enabled (Compute, Monitoring, etc.), and confirm the JSON key is valid and not expired.
Invalid key file
Invalid key file
Verify the JSON file is complete and properly formatted. Check that the private key hasn’t been truncated and that no extra whitespace or characters were added. Try regenerating the key from GCP Console.
Missing billing data
Missing billing data
Verify Billing Account Viewer role is assigned. Enable the Cloud Billing API and check that billing export to BigQuery is configured.
GKE access issues
GKE access issues
Ensure Kubernetes Engine Viewer role is assigned. Verify the cluster is in an accessible project and check if the cluster uses Workload Identity.
Security
- Least privilege — grant only the permissions the agents need for your use case; start read-only and widen later.
- Read-only by default — use read-only credentials unless you want agents to make changes through this connection.
- Rotate credentials — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
- Revoke on offboarding — remove the credential at the provider when you delete a connection or a teammate leaves.
- Project scope — limit the service account’s IAM roles to only the GCP projects CloudThinker needs to access.
- Key storage — store the service-account JSON in a secret manager and delete local copies after uploading to CloudThinker.
Related
AWS Connection
Connect Amazon Web Services
Kai Agent
Kubernetes-focused agent for GKE