I'm fairly new to AWS CDK through code and I've been looking around how to restore a database. I understand that you cannot restore Aurora database into an existing instance from snapshot (1) (2). My issue lies in the fact that we use infrastructure as a code, and therefore I need to sync the "new" database into the "old" IaC (e.g. number of instances is different)
I have managed to create a new database and change all the configurations required. However, one point I'm missing is aligning this with aws-cdk. Specifically:
- I create a new database cluster from and old snapshot
- I change the connections of my application to use this new database cluster
- I sync my IaC with the AWS state
The last point is the one that is eluding me. How do I set up my code using aws-cdk so that I use the restored database (setup, migrations, instances, ...) rather than the old one?
I've also tried to change the name to the restored one. However, I then encounter issues when I deploy to different environments - they create a new database rather than work with the existing one already.