All Products
Search
Document Center

ApsaraDB RDS:Authorize RDS to access KMS

Last Updated:Mar 30, 2026

To use transparent data encryption (TDE) on ApsaraDB RDS, you must authorize the RDS service to call Key Management Service (KMS). This involves two steps in the Resource Access Management (RAM) console: creating a policy that defines the required KMS permissions, then creating a service role that trusts RDS and attaching the policy to it.

Prerequisites

Before you begin, ensure that you have:

  • An Alibaba Cloud account with access to the RAM console

How it works

The authorization requires two RAM objects working together:

  • Policy (AliyunRDSInstanceEncryptionRolePolicy): Defines the KMS actions RDS is allowed to perform. The policy grants read and tag management access to KMS keys (kms:List*, kms:DescribeKey, kms:TagResource, kms:UntagResource) and restricts encryption operations (kms:Encrypt, kms:Decrypt, kms:GenerateDataKey) to keys that carry the acs:rds:instance-encryption: true tag — ensuring RDS can only use keys designated for RDS encryption.

  • Service role (AliyunRDSInstanceEncryptionDefaultRole): A RAM role that trusts the RDS service. Attaching the policy to this role lets RDS assume the role and call KMS on your behalf.

Create a policy

  1. Go to the Policies page.

  2. Click Create Policy.

  3. On the JSON tab, replace the existing content with the following:

    {
        "Version": "1",
        "Statement": [
            {
                "Action": [
                    "kms:List*",
                    "kms:DescribeKey",
                    "kms:TagResource",
                    "kms:UntagResource"
                ],
                "Resource": [
                    "acs:kms:*:*:*"
                ],
                "Effect": "Allow"
            },
            {
                "Action": [
                    "kms:Encrypt",
                    "kms:Decrypt",
                    "kms:GenerateDataKey"
                ],
                "Resource": [
                    "acs:kms:*:*:*"
                ],
                "Effect": "Allow",
                "Condition": {
                    "StringEqualsIgnoreCase": {
                        "kms:tag/acs:rds:instance-encryption": "true"
                    }
                }
            }
        ]
    }
  4. Click OK. In the dialog that appears, configure the following parameters and click OK.

    ParameterDescription
    NameEnter AliyunRDSInstanceEncryptionRolePolicy
    DescriptionEnter a description, for example: Authorize RDS to access KMS

Create and authorize a RAM role

After creating the policy, create a service role and attach the policy to it.

  1. Go to the Roles page.

  2. Click Create Role.

  3. Select Alibaba Cloud Service and click Next.

  4. Configure the following parameters and click OK.

    ParameterDescription
    Role TypeSelect Normal Service Role
    RAM Role NameEnter AliyunRDSInstanceEncryptionDefaultRole
    NoteEnter a description for the role
    Select Trusted ServiceSelect RDS
  5. After the The Role has been created message appears, click Add Permissions to RAM Role.

    If you closed the confirmation page, go to the Roles page, find AliyunRDSInstanceEncryptionDefaultRole, and click Grant Permission in the Actions column.
  6. In the Grant Permission panel, select AliyunRDSInstanceEncryptionRolePolicy to add it to the Selected Policy section.

  7. Click Grant permissions.

RDS can now access KMS using this role. Return to the cloud disk encryption setup for your database engine to complete the TDE configuration: