Untuk mendapatkan izin yang
diperlukan untuk melihat kunci,
minta administrator untuk memberi Anda
peran IAM Cloud KMS Viewer (roles/cloudkms.viewer)
di project Anda.
Untuk mengetahui informasi selengkapnya tentang cara memberikan peran, lihat Mengelola akses ke project, folder, dan organisasi.
Peran bawaan ini berisi
izin yang diperlukan untuk melihat kunci. Untuk melihat izin yang benar-benar diperlukan, luaskan bagian Izin yang diperlukan:
Ganti PROJECT_ID dengan nama project yang ingin Anda lihat daftar kuncinya.
Untuk mengetahui informasi tentang semua flag dan kemungkinan nilai, jalankan perintah dengan flag --help.
API
Contoh ini menggunakan curl sebagai klien HTTP
untuk menunjukkan penggunaan API. Untuk mengetahui informasi selengkapnya tentang kontrol akses, lihat
Mengakses Cloud KMS API.
CALLING_PROJECT_ID: ID project tempat Anda memanggil KMS Inventory API.
Saat melihat kunci, Anda dapat memilih kunci untuk melihat detail tentang kunci tersebut, termasuk versi kunci terkait.
Detail penting
Inventaris kunci memberikan informasi komprehensif tentang kunci kriptografi di project Anda. Properti dalam inventaris utama mencakup hal berikut:
Nama kunci: Nama kunci.
Status: Status kunci saat ini berdasarkan status versi kunci utama. Kolom ini hanya berlaku untuk kunci simetris.
Tersedia: Versi kunci utama diaktifkan. Kunci tersedia untuk digunakan mengenkripsi dan mendekripsi data.
Tidak tersedia: Versi kunci utama dinonaktifkan atau kosong. Kunci tidak tersedia untuk digunakan mengenkripsi data.
Tersedia di GCP: Untuk kunci yang dikelola secara eksternal, kunci (belum tentu kunci yang dikelola secara eksternal itu sendiri) tersedia untuk digunakan.
Key ring: Nama key ring induk.
Lokasi: Lokasi tempat materi kunci berada.
Rotasi saat ini: Tanggal dan waktu kunci terakhir dirotasi. Kolom ini
menampilkan waktu pembuatan versi kunci saat ini.
Frekuensi rotasi: Frekuensi rotasi kunci saat ini.
Rotasi berikutnya: Tanggal rotasi kunci terjadwal berikutnya. Versi kunci baru akan dibuat secara otomatis pada tanggal ini.
Koneksi EKM melalui VPC: Untuk kunci eksternal yang diakses melalui VPC, nama koneksi EKM melalui VPC yang digunakan kunci. Kolom ini disembunyikan secara default dan kosong untuk kunci dengan tingkat perlindungan selain External
via VPC.
Tujuan: Skenario saat kunci dapat digunakan.
Label: Label yang diterapkan pada kunci.
Batasan
Tab Key ring dapat menampilkan maksimal 1.000 resource (termasuk key ring, kunci, dan versi kunci) per lokasi. Untuk melihat ring kunci untuk project dan lokasi dengan lebih dari 1.000 resource, gunakan keyRings.list API.
Tab Inventaris kunci dapat menampilkan maksimal 20.000 resource (termasuk
key ring, kunci, dan versi kunci) per project. Untuk melihat kunci project dengan lebih dari 20.000 resource, gunakan keyRings.cryptoKeys.list API.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-18 UTC."],[],[],null,["# View keys by project\n\nThis page shows you how to view key rings and keys in your Google Cloud\n[project resource](/resource-manager/docs/cloud-platform-resource-hierarchy#projects).\n\nBefore you begin\n----------------\n\nBefore you can view key rings and keys, complete the setup steps described\nin this section.\n\n### Enable APIs\n\nTo view key rings and keys using an API, enable the Cloud KMS\nInventory API.\n\n[Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=kmsinventory.googleapis.com)\n\n\u003cbr /\u003e\n\n### Required roles\n\n\nTo get the permissions that\nyou need to view keys,\n\nask your administrator to grant you the\n\n\n[Cloud KMS Viewer](/iam/docs/roles-permissions/cloudkms#cloudkms.viewer) (`roles/cloudkms.viewer`)\nIAM role on your project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains\n\nthe permissions required to view keys. To see the exact permissions that are\nrequired, expand the **Required permissions** section:\n\n\n#### Required permissions\n\nThe following permissions are required to view keys:\n\n- ` ``cloudkms.keyRings.list`` `\n- ` ``cloudkms.cryptoKeys.list`` `\n- ` ``cloudkms.locations.list`` `\n- ` ``resourcemanager.projects.get`\n\n\nYou might also be able to get\nthese permissions\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nView key rings\n--------------\n\n### Console\n\n1. In the Google Cloud console, go to the **Key Rings** page.\n\n [Go to Key Rings](https://console.cloud.google.com/security/kms/keyrings)\n2. Optional: To filter your list of key rings, enter your search terms in\n the filter_list **Filter** box and\n then press Enter.\n\n3. Optional: To sort the list by the values in a column, click the\n column heading.\n\nWhile viewing your key rings, you can select a key ring to view details about\nthe associated keys and import jobs.\n\nView keys\n---------\n\nUse the Google Cloud console to view the keys created in your project resource. \n\n### Console\n\n1. In the Google Cloud console, go to the **Key Inventory** page.\n\n [Go to Key Inventory](https://console.cloud.google.com/security/kms/keys)\n2. Optional: To filter your list of keys, enter your search terms in the\n filter_list **Filter** box and then\n press Enter.\n\n3. Optional: To sort the list by the values in a column, click the\n column heading.\n\n### gcloud CLI\n\n\nTo use Cloud KMS on the command line, first\n[Install or upgrade to the latest version of Google Cloud CLI](/sdk/install).\n\n\u003cbr /\u003e\n\n```\ngcloud kms inventory list-keys --project PROJECT_ID\n```\n\nReplace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with the name of the project for which you\nwant to view the list of keys.\n\nFor information on all flags and possible values, run the command with the\n`--help` flag.\n\n### API\n\n\nThese examples use [curl](https://curl.haxx.se/) as an HTTP client\nto demonstrate using the API. For more information about access control, see\n[Accessing the Cloud KMS API](/kms/docs/accessing-the-api).\n\n\u003cbr /\u003e\n\n curl \"https://kmsinventory.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/cryptoKeys\"\n --request \"GET\" \\\n --header \"x-goog-user-project: \u003cvar translate=\"no\"\u003eCALLING_PROJECT_ID\u003c/var\u003e\"\n --header \"Content-Type: application/json\" \\\n --header \"Authorization: Bearer \u003cvar translate=\"no\"\u003eTOKEN\u003c/var\u003e\"\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project that contains the key ring.\n- \u003cvar translate=\"no\"\u003eCALLING_PROJECT_ID\u003c/var\u003e: the ID of the project from which you are calling the KMS Inventory API.\n\n| **Note:** This functionality is not available in client libraries during preview.\n\nWhile viewing your keys, you can select a key to view details about the key,\nincluding its associated key versions.\n\n### Key details\n\nThe key inventory provides comprehensive information about the cryptographic\nkeys in your project. Properties in the key inventory include the following:\n\n- **Key name**: The name of the key.\n- **Status** : The current key status based on the [state](/kms/docs/key-states) of the primary key version. This field applies to symmetric keys only.\n - **Available**: The primary key version is enabled. The key is available for use to encrypt and decrypt data.\n - **Not available**: The primary key version is disabled or empty. The key isn't available for use to encrypt data.\n - **Available in GCP**: For externally managed keys, the key (not necessarily the externally managed key itself) is available for use.\n- **Key ring**: Name of the parent key ring.\n- **Location**: Location where key material resides.\n- **Current rotation**: The date and time the key was last rotated. This field shows when the current key version was created.\n- **Rotation frequency**: The current rotation frequency of the key.\n- **Next rotation**: The date of the next scheduled key rotation. A new key version will be created automatically on this date.\n- **Protection level** : The [protection level](/kms/docs/algorithms#protection_levels) of the key, for example, HSM or Software.\n- **EKM via VPC connection** : For external keys accessed over VPC, the name of the [EKM via VPC connection](/kms/docs/create-ekm-connection#terminology) that the key uses. This field is hidden by default and is blank for keys with protection levels other than `External\n via VPC`.\n- **Purpose**: The scenario in which the key may be used.\n- **Labels**: Labels applied on the key.\n\nLimitations\n-----------\n\n- The **Key ring** tab can display at most 1,000 resources (including key\n rings, keys, and key versions) per [location](/kms/docs/locations). To view key rings for a\n project and location with more than 1,000 resources, use the\n [keyRings.list API](/kms/docs/reference/rest/v1/projects.locations.keyRings/list).\n\n- The **Key inventory** tab can display at most 20,000 resources (including\n key rings, keys, and key versions) per project. To view keys for a project\n with more than 20,000 resources, use the [keyRings.cryptoKeys.list API](/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys/list)."]]