Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Saat merujuk ke resource Cloud Key Management Service menggunakan Cloud KMS API atau Google Cloud CLI, Anda menggunakan ID resource. Misalnya, Anda dapat menggunakan ID resource
ring kunci untuk memberikan
peran Identity and Access Management (IAM) di ring kunci tersebut. Topik ini menunjukkan cara mendapatkan ID untuk key ring, kunci, dan
versi kunci.
Mendapatkan ID resource untuk key ring
Konsol
Buka halaman Pengelolaan Kunci di Google Cloud konsol.
Kunci berisi nol atau beberapa versi kunci. ID resource untuk versi
kunci adalah ID kunci, ditambah garis miring (/), ditambah ID versi. Untuk mencantumkan
semua versi kunci, klik nama kunci. Klik ikon Lainnya untuk versi, lalu klik Salin nama resource.
gcloud
Mencantumkan semua kunci di key ring tertentu:
gcloud kms keys list --keyring KEY_RING --location LOCATION
Kolom Name pada output menyertakan ID resource untuk setiap kunci. Misalnya:
Kunci memiliki nol atau beberapa versi kunci. ID resource untuk versi kunci adalah
ID kunci, ditambah garis miring (/), ditambah ID versi. Untuk mencantumkan semua versi
untuk kunci:
[[["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,["# Getting a Cloud KMS resource ID\n\nWhen you refer to a Cloud Key Management Service resource using the Cloud KMS API or Google Cloud CLI, you use the resource ID. For example, you can use the resource\nID of a key ring to grant an\n[Identity and Access Management (IAM) role](/kms/docs/reference/permissions-and-roles) on\nthat key ring. This topic shows how to get the ID for a key ring, a key, and a\nkey version.\n\nGetting the resource ID for a key ring\n--------------------------------------\n\n### Console\n\n1. Go to the **Key Management** page in the Google Cloud console.\n\n [Go to\n the Key Management page](https://console.cloud.google.com/security/kms)\n2. Click **More** *more_vert*\n for the key ring.\n\n3. Click **Copy resource name**. The resource ID for the key ring is copied to your\n clipboard.\n\n### gcloud\n\nList all key rings in a location: \n\n```\ngcloud kms keyrings list --location LOCATION\n```\n\nThe **Name** column of the output includes the resource ID for each key ring.\nFor example: \n\n```\nprojects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING\n```\n\nGetting the ID for a key and version\n------------------------------------\n\n### Console\n\n1. Go to the **Key Management** page in the Google Cloud console.\n\n [Go to\n the Key Management page](https://console.cloud.google.com/security/kms)\n2. Select the key ring that contains the key.\n\n3. For the key whose resource ID you are retrieving, click\n **More** *more_vert*.\n\n4. Click **Copy resource name**. The resource ID for the key is copied to your\n clipboard. Its format is similar to the following:\n\n ```\n projects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME\n ```\n5. A key contains zero or more key versions. The resource ID for a key\n version is the key ID, plus a slash (`/`), plus the version ID. To list\n all versions for a key, click the key's name. Click the **More** icon for\n the version, and click **Copy resource name**.\n\n### gcloud\n\nList all keys on a given key ring: \n\n```\ngcloud kms keys list --keyring KEY_RING --location LOCATION\n```\n\nThe **Name** column of the output includes the resource ID for each key. For\nexample: \n\n```\nprojects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME\n```\n\nA key has zero or more key versions. The resource ID for a key version is\nthe key ID, plus a slash (`/`), plus the version ID. To list all versions\nfor a key: \n\n```\ngcloud kms keys versions list --location LOCATION --keyring KEY_RING --key KEY_NAME\n```\n\nThe **Name** column of the output includes the resource ID for each key\nversion. For example: \n\n```\nprojects/PROJECT_ID/locations/LOCATION/keyRings/KEY_RING/cryptoKeys/KEY_NAME/2\n```\n\nWhat's next\n-----------\n\n- Learn more about [permissions and roles](/kms/docs/reference/permissions-and-roles) in Cloud KMS.\n- [Manage access to Cloud KMS resources](/kms/docs/iam).\n- [Rotate a key](/kms/docs/rotate-key)."]]