I am attempting to use conditions to scope a resource in a CloudFormation template but am having no luck. I attempted to use "Deny: NotPrincipal" as shown below but that action is not allowed due to an error "Policy document should not specify a principal". Any suggestions on how to scope ec2:CopyImage to only a specific role would be greatly appreciated. Thank you
{
"Sid": "DenyCopyAMI",
"Effect": "Deny",
"NotPrincipal": {
"AWS": [
"arn:aws:sts::*:assumed-role/EngineeringRole/*",
"arn:aws:sts::*:assumed-role/PlatformRole/*",
"arn:aws:iam::*:role/EngineeringRole/*",
"arn:aws:iam::*:role/PlatformRole/*"
]
},