Stay organized with collections
Save and categorize content based on your preferences.
When 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
ID of a key ring to grant an
Identity and Access Management (IAM) role on
that key ring. This topic shows how to get the ID for a key ring, a key, and a
key version.
Getting the resource ID for a key ring
Console
Go to the Key Management page in the Google Cloud console.
A key contains zero or more key versions. The resource ID for a key
version is the key ID, plus a slash (/), plus the version ID. To list
all versions for a key, click the key's name. Click the More icon for
the version, and click Copy resource name.
gcloud
List all keys on a given key ring:
gcloud kms keys list --keyring KEY_RING --location LOCATION
The Name column of the output includes the resource ID for each key. For
example:
A key has zero or more key versions. The resource ID for a key version is
the key ID, plus a slash (/), plus the version ID. To list all versions
for a key:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 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)."]]