Access denied when hot backup to s3

Hi Dear,
Access denied when I was using hot backup to s3, while I can access and write to the bucket by aws cli successfully. Here is my command:

use admin
db.runCommand({createBackup: 1, s3: {bucket: “mongodb-dump”, path: “testdump”} , endpoint: “xxxxxx”, region: “xxxxxx”, accessKeyId: “xxxxxx”, secretAccessKey:“xxxxxxx”})

Here is the response from shell:
“ok” : 0,
“errmsg” : “Cannot create ‘mongodb-dump’ bucket for the backup : AccessDenied : Anonymous access is forbidden for this operation”

Use “xxxxxx” to replace the actual info.

And I got following error message in log:
{“t”:{"$date":“2021-10-26T11:42:24.173+08:00”},“s”:“I”, “c”:“COMMAND”, “id”:51803, “ctx”:“conn1”,“msg”:“Slow query”,“attr”:{“type”:“command”,“ns”:“admin.$cmd”,“appName”:“MongoDB Shell”,“command”:{“createBackup”:1.0,“s3”:{“bucket”:“mongodb-dump”,“path”:“testdump”},“endpoint”:“xxxxx”,“region”:“xxxxx”,“accessKeyId”:“xxxxxx”,“secretAccessKey”:“xxxxx”,“lsid”:{“id”:{"$uuid":“bb802e94-56d1-4e0c-9804-63e3b2799708”}},"$db":“admin”},“numYields”:0,“ok”:0,“errMsg”:“Cannot create ‘mongodb-dump’ bucket for the backup : AccessDenied : Access Denied”,“errName”:“UnknownError”,“errCode”:8,“reslen”:132,“locks”:{},“protocol”:“op_msg”,“durationMillis”:10961}}

My question is that the bucket should be existed or not? I think the bucket should be existed and the path should not be existed, right?
Anyway, the error occurred no matter the bucket existed or not. So what’s wrong? Any suggestions? Your help is highly appreciated!!!

1 Like