I am able to successfully get the database backup from SQL Server instance on AWS with the following command to an S3 bucket:
-- Backup databases - MyDB
exec msdb.dbo.rds_backup_database
@source_db_name='MyDB',
@s3_arn_to_backup_to='arn:aws:s3:::mybucket/MyDB.bak',
@overwrite_S3_backup_file=1;
While Restoring the same backup to a different SQL server instance within the same region using the following command, it's not working:
-- restore databases - MyDB
EXEC msdb.dbo.rds_restore_database
@restore_db_name='MyDB',
@s3_arn_to_restore_from='arn:aws:s3:::mybucket/MyDB.bak';
i am getting the following error when checked the task status with exec msdb.dbo.rds_task_status @db_name='MyDB'
[2017-05-19 19:22:22.127] Aborted the task because of a task failure or a concurrent RESTORE_DB request.
[2017-05-19 19:22:22.150] Error making the request with Error Code Forbidden and Http Status Code Forbidden. No further error information was returned by the service.
I have done this backup and restore on multiple DB instances till now and never seen this kind of error. The S3 bucket and the SQL Server instance where the .bak file needs to be restored are in the same region, the assigned option group role has all the required permissions set on the S3 bucket as well. Below is the Options group Role policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource": [
"arn:aws:s3:::mybucket"
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetObjectMetaData",
"s3:GetObject",
"s3:PutObject",
"s3:ListMultipartUploadParts",
"s3:AbortMultipartUpload"
],
"Resource": [
"arn:aws:s3:::mybucket/*"
]
}
]
}