Cross-account key sharing in ECS
This topic describes how to share a customer master key (CMK) with another Alibaba Cloud account and use it to encrypt resources in ECS. It details the procedures for the key owner account to share a CMK and for the receiving account to use the shared key.
Use cases
-
Centralize key management for compliance
Key sharing centralizes key permissions in a single account, which facilitates auditing, tracking, and unified management.
-
Optimize costs by sharing keys
To reduce costs, you can purchase Key Management Service (KMS) instances and create keys in one Alibaba Cloud account. You can then share the keys with other Alibaba Cloud accounts used by different teams or projects. This allows these accounts to create and use encrypted resources without purchasing their own KMS instances.
How it works
In cross-account key sharing, the key owner account shares a key by granting permissions to a RAM role in another Alibaba Cloud account. The specific RAM role that requires authorization varies by use case. Snapshots and images encrypted with a shared key can still be shared.
Prerequisites
|
Role |
Prerequisites |
|
key owner account |
|
|
receiving account |
The receiving account must create different RAM roles depending on the use case.
|
Owner account: Configure key sharing
Log on to the Key Management Service console. In the top navigation bar, select a region. In the left-side navigation pane, choose .
-
On the Key Management page, select the Keys tab, and click a key ID to open the key details page.
-
On the key details page, click the Key Policy tab and then click Configure Key Policy.
-
Click Add ARN of Cross-account User, enter the principal ARN, and click OK.
acs:ram::<uid-of-receiving-account>:role/<ram-role-name>For example, to share a key with the AliyunECSDiskEncryptDefaultRole role in the Alibaba Cloud account with UID 119285303511**, use the following principal ARN:
acs:ram::119285303511**:role/AliyunECSDiskEncryptDefaultRole
Receiving account: Use a shared key
This topic uses the creation of a standalone encrypted cloud disk as an example. The steps to select a key are similar when you copy a snapshot or copy an image with encryption.
On the details page of the encrypted resource, you can view only the ID of the KMS key that is used. The ARN and alias of the KMS key are not displayed due to permission limits set by the key owner account. This display limitation does not affect the use of the encrypted resource.
Console
This section describes only the encryption settings for creating a cloud disk. For information about other configurations, see Create an empty data disk.
Go to ECS-Block Storage.
-
In the upper-left corner of the page, select the resource group and region for the target resource.
-
Click Create Disk. In the OK for the Disks, select Encrypt, select Specify Custom KMS Key, and then manually enter the shared key ID.
API
You can call the CreateDisk API operation to create a data disk. In the request, set the Encrypted and KMSKeyId parameters to encrypt the data disk.
FAQ
Related documents
-
To share an encrypted snapshot with another account, see Share snapshots.
-
To share an encrypted image with another account, see Share custom images.