Enforce disk encryption with a custom RAM policy
Create a custom RAM policy that denies ECS disk creation unless encryption is enabled, enforcing enterprise security and compliance requirements.
Background
Disk data may include sensitive information such as business secrets, user data, or financial details. Without encryption, this data can be stolen or leaked during storage or transfer. Disk encryption prevents data theft from hypervisor or physical-layer attacks — even with physical access to the disk, the data remains unreadable.
Industries such as finance, healthcare, and government require sensitive data to be encrypted. Disk encryption helps enterprises meet compliance auditing requirements and demonstrate that their data storage meets security standards.
Procedure
This example enforces disk encryption for a RAM user named Alice when creating an ECS instance or a standalone disk.
-
Create a RAM user named Alice in the RAM console.
See Create a RAM user.
-
In the RAM console, create a custom policy named ecs-disk-encrypt-control. Enter the following policy content in the JSON editor.
NoteThis policy denies ECS instance or standalone disk creation if disk encryption is disabled.
{ "Version": "1", "Statement": [ { "Action": [ "ecs:RunInstances", "ecs:CreateInstance" ], "Resource": "*", "Condition": { "StringLike": { "ecs:IsDiskEncrypted": "*false*" } }, "Effect": "Deny" }, { "Action": [ "ecs:RunInstances", "ecs:CreateInstance" ], "Resource": "*", "Condition": { "StringEquals": { "ecs:IsSystemDiskEncrypted": "false" } }, "Effect": "Deny" }, { "Action": "ecs:CreateDisk", "Resource": "*", "Condition": { "StringLike": { "ecs:IsDiskEncrypted": "*false*" } }, "Effect": "Deny" } ] } -
Create another custom policy named ecs-admin. Enter the following policy content in the JSON editor.
NoteThis policy grants ECS management permissions, including purchasing, managing, and viewing instances. This example targets an ECS administrator. Modify the policy as needed.
{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": [ "ecs:*", "ecs-workbench:*", "vpc:CheckCanAllocateVpcPrivateIpAddress", "vpc:DescribeVpcs", "vpc:DescribeVSwitches", "bss:ModifyAgreementRecord", "bss:DescribeOrderList", "bss:DescribeOrderDetail", "bss:PayOrder", "bss:CancelOrder" ], "Resource": "*" } ] } -
In the RAM console, grant the RAM user Alice the following permissions.
Set Authorization Scope to Account, set Principal to Alice, and select policies ecs-disk-encrypt-control and ecs-admin. See Manage permissions for a RAM user.
Verify the result
Log on to the Alibaba Cloud Management Console as the RAM user Alice.
See Log on to the Alibaba Cloud Management Console as a RAM user.