All Products
Search
Document Center

Key Management Service:Authorization information

Last Updated:Mar 31, 2026

Resource Access Management (RAM) controls who can call KMS API operations and which resources they can access. To grant a RAM user access to KMS, create a custom RAM policy that specifies the exact operations and resources allowed, then attach that policy to the user.

RAM provides two editing modes: visual editing and document editing. For KMS, use the document editing mode. Visual editing only allows you to select all KMS resources and all operations, which does not support least-privilege configuration.

Prerequisites

Before you begin, ensure that you have:

  • An Alibaba Cloud account with administrator access to the RAM console

  • A RAM user to grant permissions to

Policy structure

A KMS RAM policy statement contains up to four elements:

ElementRequiredDescription
EffectYesAllow or Deny
ActionYesOne or more KMS API operations in kms:<api-name> format
ResourceYesThe Alibaba Cloud Resource Name (ARN) of the target resource
ConditionNoAdditional constraints such as time-based restrictions

The Appendix below lists all supported actions, resource ARN formats, and condition keys.

Grant a RAM user access to KMS

Step 1: Create a custom policy

  1. Log on to the RAM console using your Alibaba Cloud account.

  2. In the left-side navigation pane, choose Permissions > Policies.

  3. On the Policies page, click Create Policy.

  4. On the Create Policy page, click the JSON tab.

  5. Replace the default policy content with your custom policy document. The following example grants a RAM user permission to encrypt and decrypt using a specific key, without the ability to manage or delete it:

    {
      "Version": "1",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "kms:Encrypt",                    // encrypt data using the key
            "kms:Decrypt",                    // decrypt data using the key
            "kms:GenerateDataKey"             // generate a data key for envelope encryption
          ],
          "Resource": "acs:kms:${region}:${account}:key/${key-id}"
        }
      ]
    }

    Replace ${region}, ${account}, and ${key-id} with your actual values. To target all keys in an account, use acs:kms:*:${account}:key/*.

  6. Click Optimize to validate and format the policy document (optional).

  7. Click OK.

  8. Enter a policy name and description, then click OK.

Step 2: Attach the policy to a RAM user

  1. In the left-side navigation pane, choose Identities > Users.

  2. On the Users page, find the target RAM user and click Add Permissions in the Actions column.

  3. In the Grant Permission panel, configure the following parameters and click Grant Permissions.

    ParameterDescription
    Resource ScopeSelect Account. KMS does not support the resource group feature.
    PrincipalThe RAM user to grant permissions to. Defaults to the user you selected; change as needed.
    PolicySelect the custom policy you created in step 1.

Appendix: Supported resources, actions, and conditions

Resource

KMS defines six resource types. Configure the Resource element in a RAM policy using the ARN of the target resource.

To find a key's ARN:

  1. Log on to the KMS console. In the top navigation bar, select a region. In the left-side navigation pane, choose Resource > Keys.

  2. On the Keys tab, find the key and click Details in the Actions column. The ARN appears on the details page.

    Key details

Replace ${region} and ${account} with your actual region and Alibaba Cloud account ID. ${region} supports the asterisk (*) wildcard to target all supported regions.
Resource typeARN
Key containeracs:kms:${region}:${account}:key
Secret containeracs:kms:${region}:${account}:secret
Alias containeracs:kms:${region}:${account}:alias
Keyacs:kms:${region}:${account}:key/${key-id}
Secretacs:kms:${region}:${account}:secret/${secret-name}
Aliasacs:kms:${region}:${account}:alias/${alias-name}

Wildcard examples

For keys:

  • acs:kms:${region}:${account}:key/* — all keys in a specific region within an account

  • acs:kms:*:${account}:key/* — all keys in all regions within an account

For secrets:

  • acs:kms:${region}:${account}:secret/* — all secrets in a specific region within an account

  • acs:kms:${region}:${account}:secret/prefix* — all secrets whose names start with prefix

Action

KMS defines an action for each API operation that requires access control. Actions follow the kms:<api-name> format.

The DescribeRegions operation does not require access control. It can be called by any Alibaba Cloud account, RAM user, or RAM role after passing RAM authentication.

Key-related API operations

OperationActionResource typeARN format
ListKeyskms:ListKeysKey containeracs:kms:${region}:${account}:key
CreateKeykms:CreateKeyKey containeracs:kms:${region}:${account}:key
DescribeKeykms:DescribeKeyKeyacs:kms:${region}:${account}:key/${key-id}
UpdateKeyDescriptionkms:UpdateKeyDescriptionKeyacs:kms:${region}:${account}:key/${key-id}
EnableKeykms:EnableKeyKeyacs:kms:${region}:${account}:key/${key-id}
DisableKeykms:DisableKeyKeyacs:kms:${region}:${account}:key/${key-id}
ScheduleKeyDeletionkms:ScheduleKeyDeletionKeyacs:kms:${region}:${account}:key/${key-id}
CancelKeyDeletionkms:CancelKeyDeletionKeyacs:kms:${region}:${account}:key/${key-id}
GetParametersForImportkms:GetParametersForImportKeyacs:kms:${region}:${account}:key/${key-id}
ImportKeyMaterialkms:ImportKeyMaterialKeyacs:kms:${region}:${account}:key/${key-id}
DeleteKeyMaterialkms:DeleteKeyMaterialKeyacs:kms:${region}:${account}:key/${key-id}
ListAliasesByKeyIdkms:ListAliasesByKeyIdKeyacs:kms:${region}:${account}:key/${key-id}
CreateKeyVersionkms:CreateKeyVersionKeyacs:kms:${region}:${account}:key/${key-id}
DescribeKeyVersionkms:DescribeKeyVersionKeyacs:kms:${region}:${account}:key/${key-id}
ListKeyVersionskms:ListKeyVersionsKeyacs:kms:${region}:${account}:key/${key-id}
UpdateRotationPolicykms:UpdateRotationPolicyKeyacs:kms:${region}:${account}:key/${key-id}
Encryptkms:EncryptKeyacs:kms:${region}:${account}:key/${key-id}
Decryptkms:DecryptKeyacs:kms:${region}:${account}:key/${key-id}
ReEncryptkms:ReEncryptFrom (source key) and kms:ReEncryptTo (destination key)Keyacs:kms:${region}:${account}:key/${key-id}
GenerateDataKeykms:GenerateDataKeyKeyacs:kms:${region}:${account}:key/${key-id}
GenerateDataKeyWithoutPlaintextkms:GenerateDataKeyWithoutPlaintextKeyacs:kms:${region}:${account}:key/${key-id}
ExportDataKeykms:ExportDataKeyKeyacs:kms:${region}:${account}:key/${key-id}
GenerateAndExportDataKeykms:GenerateAndExportDataKeyKeyacs:kms:${region}:${account}:key/${key-id}
AsymmetricSignkms:AsymmetricSignKeyacs:kms:${region}:${account}:key/${key-id}
AsymmetricVerifykms:AsymmetricVerifyKeyacs:kms:${region}:${account}:key/${key-id}
AsymmetricEncryptkms:AsymmetricEncryptKeyacs:kms:${region}:${account}:key/${key-id}
AsymmetricDecryptkms:AsymmetricDecryptKeyacs:kms:${region}:${account}:key/${key-id}
GetPublicKeykms:GetPublicKeyKeyacs:kms:${region}:${account}:key/${key-id}
ListAliaseskms:ListAliasesAlias containeracs:kms:${region}:${account}:alias
CreateAliaskms:CreateAliasAlias and keyAlias: acs:kms:${region}:${account}:alias/${alias-name} and Key: acs:kms:${region}:${account}:key/${key-id}
UpdateAliaskms:UpdateAliasAlias and keyAlias: acs:kms:${region}:${account}:alias/${alias-name} and Key: acs:kms:${region}:${account}:key/${key-id}
DeleteAliaskms:DeleteAliasAlias and keyAlias: acs:kms:${region}:${account}:alias/${alias-name} and Key: acs:kms:${region}:${account}:key/${key-id}

Secret-related API operations

OperationActionResource typeARN
CreateSecretkms:CreateSecretSecret containeracs:kms:${region}:${account}:secret
ListSecretskms:ListSecretsSecret containeracs:kms:${region}:${account}:secret
DescribeSecretkms:DescribeSecretSecretacs:kms:${region}:${account}:secret/${secret-name}
DeleteSecretkms:DeleteSecretSecretacs:kms:${region}:${account}:secret/${secret-name}
UpdateSecretkms:UpdateSecretSecretacs:kms:${region}:${account}:secret/${secret-name}
RestoreSecretkms:RestoreSecretSecretacs:kms:${region}:${account}:secret/${secret-name}
GetSecretValuekms:GetSecretValue (always) and kms:Decrypt (only when a self-managed key is used as the encryption key)Secretacs:kms:${region}:${account}:secret/${secret-name}
PutSecretValuekms:PutSecretValue (always) and kms:GenerateDataKey (only when a self-managed key is used as the encryption key)Secretacs:kms:${region}:${account}:secret/${secret-name}
ListSecretVersionIdskms:ListSecretVersionIdsSecretacs:kms:${region}:${account}:secret/${secret-name}
UpdateSecretVersionStagekms:UpdateSecretVersionStageSecretacs:kms:${region}:${account}:secret/${secret-name}
GetRandomPasswordkms:GetRandomPasswordNoneNone

Tag-related API operations

OperationActionResource typeARN
ListResourceTagskms:ListResourceTagsKey or secretKey: acs:kms:${region}:${account}:key/${key-id} or Secret: acs:kms:${region}:${account}:secret/${secret-name}
UntagResourcekms:UntagResourceKey or secretKey: acs:kms:${region}:${account}:key/${key-id} or Secret: acs:kms:${region}:${account}:secret/${secret-name}
TagResourcekms:TagResourceKey or secretKey: acs:kms:${region}:${account}:key/${key-id} or Secret: acs:kms:${region}:${account}:secret/${secret-name}

Condition

The Condition element is optional. Add condition keys to a RAM policy to enforce additional constraints — RAM authentication succeeds only when all specified conditions are met.

Two types of condition keys are supported:

  • Common condition keys in acs:<condition-key> format — for example, use acs:CurrentTime to restrict a policy to a specific time window. For the full list, see Policy elements.

  • KMS-specific condition keys in kms:<condition-key> format — for the full list, see Condition keys.

For more information about RAM policy syntax and structure, see Policy structure and syntax.