Search code examples
rubyamazon-web-servicesamazon-rds

Amazon RDS: Restore cluster snapshot no db instance


I'm getting problems restoring AWS RDS cluster snapshot.

My snapshots are generating automatically from AWS via console config. Now I'm trying restore those snapshots via AWS RDS API for Ruby. I use restore_db_cluster_from_snapshot function and I restore cluster successfully but this new cluster haven't any db instance attached.

I can't generate db_snapshot because my db it's on cluster, I only have db_cluster_snapshot. Because this I can't use restore_db_instance_from_db_snapshot function.

Simply example of working code:

db_cluster = @rds.restore_db_cluster_from_snapshot({
                                                    db_cluster_identifier: 'restored-from-rake',
                                                    snapshot_identifier: '',
                                                    engine: snapshot_data.engine,
                                                    database_name: 'restored-from-rake-db'
                                                  })

Any idea about this?. Thanks in advance.


Solution

  • Restoring an Aurora (cluster) snapshot involves 2 steps:

    1. Restore the cluster snapshot to an Aurora cluster, then
    2. Add RDS instances to your cluster.

    So, once you've restored your RDS cluster, follow that with a call to @rds.create_db_instance():

    db_instances = @rds.create_db_instance({ 
        db_cluster_identifier: 'restored-from-rake', 
        ... 
    })