amazon-web-servicesamazon-rdsaws-cdksnapshotdatabase-restore

Restoring an AWS Aurora cluster from a snapshot using the same cluster identifier using CDK


Scenario:

Problem: the old cluster and new cluster must carry the exact same cluster identifier. Because AWS deletes the old cluster only after the new cluster is created, this results in a naming conflict.

Is there any feasible way to reach my goal of having the new cluster carrying the exact same name? On our production environment, there is deletion protection so I cannot create a custom resource to delete the cluster before the new one is created.


Solution

    1. Manually rename my_cluster to my_cluster_old. Follow this AWS guide (see caveats about read replicas). The commands for clusters may be somewhat different (e.g., modify-db-cluster).
    2. Restore the snapshot to my_cluster.
    3. Delete my_cluster_old.