Transparent Data Encryption (TDE) requires PolarDB to access Key Management Service (KMS). To grant this access, create a dedicated access policy and RAM role in the Resource Access Management (RAM) console.
Prerequisites
Before you begin, make sure that you have:
An Alibaba Cloud account (RAM users cannot perform this operation)
Step 1: Create the AliyunRDSInstanceEncryptionRolePolicy access policy
Log on to the Policy Management page of the RAM console.
Click Create Policy.
NoteAn access policy is a collection of permissions that uses a specific syntax to define authorized resources, operations, and conditions.
Click the JSON tab and paste the following JSON into the code editor.
{ "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" } } } ] }The policy grants two sets of permissions:
Permission Actions Purpose Key management kms:List*,kms:DescribeKey,kms:TagResource,kms:UntagResourceList and describe KMS keys across all resources Data encryption (scoped) kms:Encrypt,kms:Decrypt,kms:GenerateDataKeyEncrypt and decrypt data, and generate data encryption keys — restricted to keys tagged with acs:rds:instance-encryption: trueClick OK. In the dialog box, fill in the following fields:
Parameter Value Policy Name AliyunRDSInstanceEncryptionRolePolicyDescription For example: Used for PolarDB to access KMS Click OK.
Step 2: Create and authorize the AliyunRDSInstanceEncryptionDefaultRole RAM role
After creating the policy, attach it to a RAM role so that PolarDB can assume the role to access KMS.
Log on to the Role Management page of the RAM console.
Click Create Role.
Select Cloud Service. From the Principal Name drop-down list, select the ApsaraDB RDS option that ends with
rds.aliyuncs.com, and then click OK.In the Create Role dialog box, set Role Name to
AliyunRDSInstanceEncryptionDefaultRoleand click OK.On the role details page, click the Permissions tab, and then click Grant Permission.
On the Grant Permission page, search for
AliyunRDSInstanceEncryptionRolePolicy. Click the policy name to move it to the Selected Policy box on the right.Click Grant Permissions.
What's next
With the access policy and RAM role in place, PolarDB has the permissions it needs to access KMS. You can now enable TDE for your cluster, or enable TDE when creating a new cluster.