I have the following resource policy for my AWS Secrets Manager
{
"Version" : "2012-10-17",
"Statement" : [ {
"Sid" : "policyForSomething",
"Effect" : "Deny",
"Condition": {
"StringNotEquals": {
"aws:PrincipalArn": [ "arn:aws:sts::**********:assumed-role/####/USERG",
"arn:aws:sts::**********:assumed-role/####/USER1",
"arn:aws:sts::**********:assumed-role/####/USER2",
"arn:aws:sts::**********:assumed-role/####/USER3",
"arn:aws:sts::**********:assumed-role/####/USER4" ]
}
},
"Action" : "secretsmanager:*",
"Resource" : "arn:aws:secretsmanager:us-west-2:*******:secret:/*"
}]
}
When I try to check using New Policy wizard, I don't see any error. But when I put it in the Resource Policy area for Secrets Manager, it's always Complaining "This Resource policy contains a syntax error".
Other than the fact that "AWS UI and error messages aren't always helpful" - could anyone help me understanding why this is an issue?
You're required to have one of
Principal
andNotPrincipal
in your resource-based policy. Try usingPrincipal
withAllow
, orNotPrincipal
withDeny
.Also, since you are using a resource-based policy, the
Resource
automatically and implicitly becomes the secret with your policy. (So you can safely use'*'
there)Principal
withAllow
:NotPrincipal
withDeny
:Reference: