# View your assets

This document shows you how to view your assets using Cloud Asset Inventory and the
Google Cloud CLI in Cloud Shell.

## Before you begin

To complete the instructions in this document, you need to enable the
Cloud Asset Inventory API and set up permissions for access to Cloud Asset Inventory and
Compute Engine.

### Required roles


To get the permissions that
you need to complete these instructions,

ask your administrator to grant you the
following IAM roles on the organization, folder, or project:

- To view asset metadata: [Cloud Asset Viewer](https://docs.cloud.google.com/iam/docs/roles-permissions/cloudasset#cloudasset.viewer) (`roles/cloudasset.viewer`)
- To create and delete a Compute Engine VM instance:
  - [Compute Instance Admin (v1)](https://docs.cloud.google.com/iam/docs/roles-permissions/compute#compute.instanceAdmin.v1) (`roles/compute.instanceAdmin.v1`)
  - [Service Account User](https://docs.cloud.google.com/iam/docs/roles-permissions/iam#iam.serviceAccountUser) (`roles/iam.serviceAccountUser`)


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access).


These predefined roles contain

the permissions required to complete these instructions. To see the exact permissions that are
required, expand the **Required permissions** section:


#### Required permissions

The following permissions are required to complete these instructions:

- To list asset metadata: `cloudasset.assets.listResource`
- To create a Compute Engine VM instance:
  - `compute.disks.create`
  - `compute.instances.create`
  - `compute.instances.delete`
  - `compute.instances.setServiceAccount`
  - `compute.projects.get`
  - `compute.subnetworks.use`
  - `compute.subnetworks.useExternalIp`
  - `compute.zoneOperations.get`


You might also be able to get
these permissions
with [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles) or
other [predefined roles](https://docs.cloud.google.com/iam/docs/roles-overview#predefined).

## View your assets

In a project of your choice, create a Compute Engine VM instance so that
you can view it in Cloud Asset Inventory:

1. In the Google Cloud console, go to the **VM instances** page.


   [Go to VM instances](https://console.cloud.google.com/compute/instances)

   <br />

2. Click **Create instance**.

3. Enter a name for the instance.

4. Click **Create**.

5. Wait for the instance to be created.

List all the VM instances in your project:

1. In the Google Cloud console, click
   **Activate Cloud Shell**.

2. In Cloud Shell, run the following command:

       gcloud asset list \
           --project=PROJECT_ID \
           --asset-types=compute.googleapis.com/Instance \
           --content-type=resource

   Replace `PROJECT_ID` with the ID of the project whose
   assets you want to list.

   In the previous code sample, an asset type of
   `compute.googleapis.com/Instance` is used to only list
   Compute Engine VM instances. To view all asset types, see
   [Asset types](https://docs.cloud.google.com/asset-inventory/docs/asset-types).

   A content type of `resource` has also been set. This specifies that
   `resource` metadata should also be returned in the response. If no
   content type is set, then only basic information about each asset is
   returned, such as the asset name, the last time it was updated, and what
   project it's in.

## Clean up


To avoid incurring charges to your Google Cloud account for
the resources used on this page, follow these steps.

1. In the Google Cloud console, go to the **VM instances** page.


   [Go to VM instances](https://console.cloud.google.com/compute/instances)

   <br />

2. In the same row as the name of the VM instance you created, click
   **More actions**.

3. Click **Delete**, and then confirm the deletion.

## What's next

- To explore more options related to viewing your assets, see [List assets](https://docs.cloud.google.com/asset-inventory/docs/list-assets).