In the end, I found DeleteDBSnapshot permission, but later I realized that what I really wanted to do was restrict the actions to a specific database instance identifier, which, as I have now seen, is impossible due to how the AWS commands really work. So you should create a policy that looks something like this:
{ "Statement": [ { "Effect": "Allow", "Action": [ "rds:AddTagsToResource", "rds:DeleteDBSnapshot" ], "Condition": { "streq": { "rds:snapshot-tag/MY_TAG_KEY": [ "MY_TAG_VALUE" ] } }, "Resource": "arn:aws:rds:us-west-2::snapshot:mydb-snapshot-*" }, { "Effect": "Allow", "Action": [ "rds:ListTagsForResource", "rds:CreateDBSnapshot" ], "Resource": "arn:aws:rds:us-west-2:*" }, { "Effect": "Allow", "Action": [ "rds:DescribeDBSnapshots" ], "Resource": "*" } ] }
A few notes / disclaimers:
- For most snapshot commands, the
Resource property of the policy is a check against DBSnapshotIdentifier , but for CreateDBSnapshot it refers to DBInstanceIdentifier (RDS database name). DescribeDBSnapshots always works globally, so it must also be provided for all resource values. You canβt even limit it by region.ListTagsForResource throws a permission error if you try to limit it to the entire path of the snapshot resource.- You do not need this, but I have included an example
Condition for those who wish to additionally (or alternately) limit to tags. Like the Resource restriction, ListTagsForResource and CreateDBSnapshot do not work if you try to restrict them to specific tags.
This solves my main problem of limiting damage if the keys attached to this policy are compromised - an attacker can only delete my rolling snapshots, and not manually created snapshots or database instances themselves. Unfortunately, it still allows you to create an unlimited number of snapshots in a specific area, but there seems to be no restriction on the CreateDBSnapshot restriction.
source share