Melihat aset Anda
Dokumen ini menunjukkan cara melihat aset menggunakan Inventaris Aset Cloud dan Google Cloud CLI di Cloud Shell.
Sebelum memulai
Sebelum dapat menggunakan Cloud Asset Inventory, Anda harus mengaktifkan Cloud Asset Inventory API dan menyiapkan izin.
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Enable the Cloud Asset Inventory API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin
), which contains theserviceusage.services.enable
permission. Learn how to grant roles. -
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Enable the Cloud Asset Inventory API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin
), which contains theserviceusage.services.enable
permission. Learn how to grant roles. -
Berikan peran berikut kepada pengguna Anda:
Cloud Asset Owner (
roles/cloudasset.owner
). Di konsol Google Cloud , buka halaman VM instances.
Klik Create instance.
Masukkan nama untuk instance.
Klik Buat.
Di Google Cloud konsol, klik
Activate Cloud Shell.Jalankan perintah berikut di Cloud Shell:
gcloud asset list \ --project=PROJECT_ID \ --asset-types=compute.googleapis.com/Instance \ --content-type=resource
Ganti
PROJECT_ID
dengan ID project yang asetnya ingin Anda cantumkan.Dalam contoh kode sebelumnya, jenis aset
compute.googleapis.com/Instance
digunakan untuk mencantumkan instance VM Compute Engine saja. Untuk melihat semua jenis aset, lihat Jenis aset.Jenis konten
resource
juga telah ditetapkan. Hal ini menentukan bahwa metadataresource
juga harus ditampilkan dalam respons. Jika tidak ada jenis konten yang ditetapkan, hanya informasi dasar tentang setiap aset yang ditampilkan, seperti nama aset, terakhir kali aset diperbarui, dan project tempat aset berada.Di konsol Google Cloud , buka halaman VM instances.
Di baris yang sama dengan nama instance VM yang Anda buat, klik
More actions.Klik Hapus, lalu konfirmasi penghapusan.
- Untuk mempelajari opsi lainnya terkait melihat aset, lihat artikel Mencantumkan aset.
Melihat aset Anda
Di project pilihan Anda, buat instance VM Compute Engine sehingga Anda dapat melihatnya di Inventaris Aset Cloud:
Mencantumkan semua instance VM dalam project Anda:
Pembersihan
Agar akun Google Cloud Anda tidak dikenai biaya untuk resource yang digunakan pada halaman ini, ikuti langkah-langkah berikut.