Is it possible to enforce that all accounts within an AWS organization can only create encrypted EBS volumes?
I know you can enforce it using IAM roles, but I want to know if it can be done with SCP.
Here's what I've come up with so far, but it doesn't work. I've attached this to an account within my organisation but I can create both encrypted and unencrypted volumes.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": "ec2:CreateVolume",
"Resource": "*",
"Condition": {
"Bool": {
"ec2:Encrypted": "false"
}
}
}
]
}
Updated Sept 2020
The information on the AWS page linked below has changed. The limitation around EC2 and root users appears to have been removed. The following policy should work
You can and probably should restrict the root user more generally using a policy such as the one found on this page. The root user shouldn't be used for routine administration, but having them available and with permissions to do key tasks as a break-glass is sensible.
Original Answer April 2019
It turns out that SCP works as expected, but there's a catch - according to this AWS page "All condition keys that start with "ec2" aren't evaluated when using root credentials".
Because the requirement for the volume to be encrypted is within a condition key it was not enforced while I was logged in as root. When I logged in as an IAM user the SCP was enforced as expected.
Here's the full text from the AWS documentation.
AWS Docs
Here's the SCP they link to