Just testing the duplicity restore process - in this case to a new, unused MIAB on 22.04. Backup is to an AWS S3 bucket.
Initial backup and incremental backups work fine from the box and I can see files written in the bucket and the backup status page on the MIAB is updated accordingly.
So at this point I know the bucket is working and my access to that bucket works (S3 Access Key/S3 Secret Access Key).
Now, coming to testing the restore:
export AWS_ACCESS_KEY_ID=my access key same as used in backup configuration
export AWS_SECRET_ACCESS_KEY=my access key same as used in backup configuration
export PASSPHRASE=$(cat /home/user-data/backup/secret_key.txt)
sudo -E duplicity restore --force s3://amazonregionusedinbackupconfig.amazonaws.com/bucketname/folder /home/user-data/
I get:
Attempt of list Nr. 1 failed. ClientError: An error occurred (403) when calling the HeadBucket operation: Forbidden
Attempt of list Nr. 2 failed. AttributeError: 'NoneType' object has no attribute 'objects'
Attempt of list Nr. 3 failed. AttributeError: 'NoneType' object has no attribute 'objects'
Attempt of list Nr. 4 failed. AttributeError: 'NoneType' object has no attribute 'objects'
Giving up after 5 attempts. AttributeError: 'NoneType' object has no attribute 'objects'
Which, given the ‘403’ suggests either permission issues or the objects do not exist.
Given I can backup (so my access keys must be correct) my assumption is that it’s permissions related and I must be missing an action in the S3 policy I have applied:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:GetBucketPublicAccessBlock",
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:DeleteObject",
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::bucketname/*",
"arn:aws:s3:::bucketname",
]
}
]
}
But even applying a blanket S3 policy:
"Action": [
"s3:*"
],
Has no impact.
The policy is applied to a group and the user (with the access keys) is a member of the group.
So I can write to the bucket using duplicity when backing up but appear to be unable to read from the bucket for a restore.
Any suggestions would be welcome.