1 Answer
- Newest
- Most votes
- Most comments
0
Hello.
You can obtain a backup by registering the IAM role used by AWS Backup as an exception as shown below.
By modifying the bucket policy as follows, you can allow access from AWS Backup and obtain a backup.
{
"Sid": "DenyAllExceptSpecifiedVPC",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::s3-document",
"arn:aws:s3:::s3-document/*"
],
"Condition": {
"StringNotLike": {
"aws:userid": "AROASAMPLESAMPLESAMPL:*"
},
"StringNotEquals": {
"aws:sourceVpc": "<my VPC ID>"
}
}
}
You can check the "RoleId" set in the bucket policy using the following AWS CLI command.
aws iam get-role --role-name AWSBackupDefaultServiceRole
{
"Role": {
"Path": "/service-role/",
"RoleName": "AWSBackupDefaultServiceRole",
"RoleId": "AROASAMPLESAMPLESAMPL",
"Arn": "arn:aws:iam::<account-id>:role/service-role/AWSBackupDefaultServiceRole",
"CreateDate": "2022-08-15T07:46:37+00:00",
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "backup.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
},
"Description": "Provides AWS Backup permission to create backups and perform restores on your behalf across AWS services",
"MaxSessionDuration": 3600,
"RoleLastUsed": {}
}
}
Relevant content
asked a year ago

The solution should work, but I'd suggest using the
aws:PrincipalArncondition key instead ofaws:useridto specify the IAM role of AWS Backup. The unique ID of the role is randomly generated, while the role ARN is human-readable.On another note, the VPC restriction also blocks access by other AWS services, such as AWS Config (also relied on by Security Hub) and Trusted Advisor. You might want to include their role ARNs in the exceptions for
aws:PrincipalArn.