Amazon RDS: Restore snapshot to existing instance

I have created a snapshot of my instance and made some unwanted changes in DB.

Now I want to restore my instance from this snapshot.

When I try to do it - it creates me one more instance, additionally to the one I have.

I specify "DB Instance Identifier" and after that I get two instances with the same ID.

So my question: Is there any way to restore snapshot to existing instance?

Because in other case - new instance is created with differrent endpoint (hostname) and I need to change my configs to access database. Or there is a better way to manage such cases?


Solution 1:

No you can't restore back your existing DB instance to any of the either manual backup or point-in-time snapshot.

The only way you can make use of the manual backup or automated snapshot is to create a new RDS DB instance using that. Once the new DB instance is created, you can change the endpoint of DB in your app / code and delete the old DB instance.

Bottomline : You have to change the config settings in your app. No other option.

Solution 2:

If anyone came here (just like me) to just restore data without altering your configuration.

Here are the steps :

  • Create a new instance(temp) from your automatic snapshots or manually created ones.
  • Connect to this instance from either Sequel pro or Mysql workbench.
  • Take SQL dump of whatever data you needed from this temp instance.
  • Connect your production instance and restore it.
  • Now delete the temp instance you created.

Solution 3:

Rename original instance and name new instance with original name

https://aws.amazon.com/blogs/aws/endpoint-renaming-for-amazon-rds/

Solution 4:

I had the same issue today. I think you have two options without changing the application's configuration setting.

  1. delete the old instance as Mike suggested, then restore it.

  2. rename the old instance first ( need to check "Apply immediately" option when rename it).

Solution 5:

As @MaXimus said (I cannot add comments yet) you can:

  1. rename original instance first
  2. restore from snapshot and assign original instance name

As it's specified in Renaming to Replace an Existing DB Instance here: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_RenameInstance.html