Topic 4 of 5
Once an organization has hundreds of projects, the question "what do we have and who can access it?" can't be answered by hand anymore. The exam guide asks for "Configuring Cloud Asset Inventory and using Gemini Cloud Assist to analyze resources": the first keeps the metadata inventory, and the second is the AI assistant that helps you design, operate, and optimize.
Contents
A global metadata inventory to view, search, export, monitor, and analyze Google Cloud assets. It is designed for compliance tracking, scheduled audits, and analytics.
Resource discovery
Filter by location, creation time, tags, or status.
Resource monitoring
Track how a resource changes over time to audit, debug, and catch compliance drift.
Security and cost audits
Find resources that are over-permissioned, publicly exposed, or unused.
Not for real time
Google warns that it isn't designed for real-time queries where stale data could break availability or security enforcement. For that, call the service's API directly.
When you query, you specify which metadata you want. Without a content type you get only the basics: asset name, last update, and its ancestors (project, folders, organization).
| API (gcloud) | What it returns |
|---|---|
RESOURCE (resource) | All of the resource's metadata |
IAM_POLICY (iam-policy) | The resource's IAM policy bindings |
ORG_POLICY (org-policy) | Organization policies (v1); for v2 use RESOURCE with the orgpolicy.googleapis.com/Policy type |
ACCESS_POLICY (access-policy) | Access Context Manager policies |
OS_INVENTORY (os-inventory) | VM operating system inventory. Requires setting up VM Manager |
RELATIONSHIP (relationship) | Relationships between resources (e.g. a VM uses a disk). Requires Security Command Center Premium or Enterprise, or Gemini Cloud Assist |
Enable the Cloud Asset Inventory API. In the project you run the commands from (cloudasset.googleapis.com).
Grant the right role. Cloud Asset Viewer (roles/cloudasset.viewer) to read the inventory on the project, folder, or organization.
Prepare the destination. A BigQuery dataset or bucket for exports, or a Pub/Sub topic for feeds.
In the console, the Asset Inventory page has a Resource tab where you filter with the search syntax, see the equivalent gcloud query (View query), and download the results as CSV.
# List a project's Compute Engine assets gcloud asset list --project=PROJECT_ID --asset-types=compute.googleapis.com/Instance # Search resources in an organization gcloud asset search-all-resources --scope=organizations/ORG_ID --query="location:us-central1" # Search IAM policies that grant public access gcloud asset search-all-iam-policies --scope=organizations/ORG_ID \ --query="memberTypes:(allUsers OR allAuthenticatedUsers)" --format="table(resource)"
An export takes a snapshot of the organization, folder, or project (it can be from a past date, up to 35 days back) to analyze with SQL in BigQuery or store in Cloud Storage.
gcloud asset export --project=my-project --content-type=resource \ --snapshot-time="2024-01-30" \ --bigquery-table=projects/my-project/datasets/my-dataset/tables/my-table
--per-asset-type you get one table per asset type, with columns for the nested fields.--output-bigquery-force.numRows, may be exported as null.A feed sends a notification to a Pub/Sub topic whenever the resources, IAM policies, access policies, or organization policies you choose change in an organization, folder, or project. You can add conditions so you only get certain kinds of changes.
gcloud asset feeds create my-feed --project=my-project \ --pubsub-topic=projects/my-project/topics/my-topic \ --asset-names=//storage.googleapis.com/my-bucket --content-type=iam-policy
TemporalAsset objects with the new state and the previous one (priorAsset).An AI collaborator built into Google Cloud that helps you design, deploy, troubleshoot, and optimize workloads. Google describes it as a multi-agent ecosystem with reasoning, tool calls, and long-term memory.
It uses as context your project and organization IDs, the console page you are viewing (URL and visible text), and session memory. Several of its features are in preview. Like any generative AI, it can produce plausible but incorrect output: Google recommends validating everything it generates.
An administrator sets it up for a project or folder before the team can use it.
Admin for Gemini → Get Gemini Cloud Assist. Pick the recommended APIs and click Enable Gemini Cloud Assist at no cost.
Grant roles to each principal. Gemini Cloud Assist User and Cloud Asset Viewer, plus roles for the products they want help with.
Optional settings. Share prompts to improve the product, custom instructions, grounding.
gcloud services enable geminicloudassist.googleapis.com --project PROJECT_ID gcloud services enable cloudasset.googleapis.com designcenter.googleapis.com \ appoptimize.googleapis.com apphub.googleapis.com --project PROJECT_ID
Cautions
| Area | Examples |
|---|---|
| Design and build | Natural language architecture design in Application Design Center; generate and refine gcloud commands, kubectl manifests, and Terraform; pick IAM roles and understand policies |
| Support and troubleshooting | Investigations that analyze logs, metrics, and configurations like a user-guided SRE; automatic investigations when an alert fires; performance issues in Cloud SQL, AlloyDB, BigQuery, and Spanner; handoff to support with context |
| Observability | Explore metrics, logs, alerts, and errors in natural language |
| Optimize | Questions about spend (extends Cloud Hub Optimization and Cost Explorer), FinOps Hub, daily cost anomaly analysis, Storage Insights, Flow Analyzer |
| Platform | Proactive agents that act with their own service account (Agent Identity) and are audit-logged; MCP to use it from Gemini CLI or other clients; custom instructions |
Cloud Assist panel
Conversational help in the console and the Cloud mobile app.
Console quick prompts
Buttons and interactive elements throughout the console.
Cloud Hub
Cost and utilization optimization of resources and applications for DevOps teams.
Database Center
Centralized management of the database fleet.
Application Design Center
Design applications from technical and business requirements.
Investigations
Diagnosis from the console, the mobile app, the CLI, and IDEs.
| Situation | Answer | Why |
|---|---|---|
| Find every resource with public access (allUsers) in the organization | gcloud asset search-all-iam-policies with memberTypes | Searches allow policies across the hierarchy. |
| Analyze the organization's full inventory with SQL | gcloud asset export to BigQuery | Exports a metadata snapshot. |
| Get notified every time someone changes a bucket's IAM policy | Cloud Asset Inventory feed to Pub/Sub | Real-time change notification. |
| Find out what a resource looked like 20 days ago | Cloud Asset Inventory history | Keeps 35 days of history. |
| Check in production whether a VM exists right now | Call the service API | Cloud Asset Inventory isn't for real-time queries. |
| Investigate an error with AI from logs and metrics | Gemini Cloud Assist investigation | Explores hypotheses and traces the root cause. |
| Generate a gcloud command or Terraform code from natural language | Cloud Assist panel chat | Generates and refines IaC. |
❓ How much history does Cloud Asset Inventory keep?
35 days of create, update, and delete history.
❓ Through which channel do feed notifications arrive?
A Pub/Sub topic.
❓ Which role lets you read the inventory?
Cloud Asset Viewer (roles/cloudasset.viewer).
❓ Can you append an export to a BigQuery table that already has data?
Only if it is partitioned. Otherwise the table must be empty or overwritten with --output-bigquery-force.
❓ Which roles does a user need to use Gemini Cloud Assist?
Gemini Cloud Assist User and Cloud Asset Viewer, plus roles for the products they ask about.
❓ Should you enable Gemini Cloud Assist in a project with data residency requirements?
No. It can store data in any Google Cloud data center in the world.
Did you get this topic?
Test what you just learned
The security team wants a function to run automatically every time someone changes the IAM policy of any project in a folder. What should they configure?
Original questions, each with a full explanation.
Start a mock exam