I am using boto3 to restore a db snapshot to a new db instance, which is not created yet.
rds.restore_db_instance_from_db_snapshot(
DBInstanceIdentifier=temp_db_name,
DBSnapshotIdentifier=snapshot_id
)
and I got this error message:
botocore.exceptions.ClientError: An error occurred (InvalidParameterCombination)
when calling the RestoreDBInstanceFromDBSnapshot operation:
The option group myproject-mysql-5-6 is associated with a different
VPC than the request.
How can I resolve this problem?
I do not know how to locate the option group in the first place.
I can work out the VpcId
and OptionGroupName
from the data returned from describe_db_snapshots
.
Here is a documentation related to the VPC setting:
When you assign an option group to a DB instance, the option group is also linked to the supported platform the DB instance is on, either VPC or EC2-Classic (non-VPC). If a DB instance is in a VPC, the option group associated with the DB instance is linked to that VPC. This means that you can't use the option group assigned to a DB instance if you attempt to restore the instance into a different VPC or onto a different platform. If you restore a DB instance into a different VPC or onto a different platform, you must either assign the default option group to the instance, assign an option group that is linked to that VPC or platform, or create a new option group and assign it to the DB instance. For persistent or permanent options, when restoring a DB instance into a different VPC you must create a new option group that includes the persistent or permanent option.
However I don't see how this can be applied to the restore_db_instance_from_db_snapshot
call.
EDIT
If I tried to restore the snapshot in aws console, this option is available to me:
How can I set these information via the boto3
API?