如何管理RDS数据库,包括从CDK中的快照恢复
我正在管理CDK项目中管理RDS数据库。从快照中恢复数据库的旧状态是必要的。
为了实现这一目标,我有CDK上下文参数指定应从中恢复数据库的快照。如果给出,快照将低音到RDS构造。这导致替换数据库(很好)。
现在,如果数据库已从快照中恢复,并且我在CDK项目中进行了其他一些更新,并希望更新项目(通过CD Pipeline完成),我将其用通常启动更新而无需提供任何快照。这导致数据库被一个空的数据库取代,这当然不是我想要的。
总而言之,这就是当前的工作方式:
堆栈 | 部署参数 | 的 |
---|---|---|
当前状态未从快照中创建的 | 没有快照 | DB所产生的未替换, |
未从快照 | DB创建的Snapshot | 快照db中替换 |
从快照中创建的 | no Snapshot | 替换 |
DB,从Snapshot Snapshot | Snapshot(相同) (相同) ) | 未 |
用快照 | 快照(不同的) | DB替换DB, |
这是IMHO无法管理的。
但是我想要的是这样的:
堆栈 | 部署参数 | 结果 |
---|---|---|
的当前状态未从快照中创建的 | 没有快照 | 的未替换 |
DB所产生 | 了没有Snapshot DB创建的Snapshot | db |
而不是从快照快照db中创建的,从快照中创建 | ,no snapshot | 替换 |
snapshot snapshot | snapshot(相同)(相同) ) | 替换DB |
从快照 | 快照(不同) | db替换的DB被替换 |
,或者说,换句话说:
- 如果我没有指定快照,请不要替换DB,
- 如果我指定了快照,请重复DB
吗?还是使用CDK管理RDS数据库的另一种好方法?
I am managing an RDS Database in an CDK Project. From time to time it is necasary to recover an old state of the database from snapshot.
To make this possible, I have CDK Context Parameter specifying the Snapshot from which the Database should be recovered. If it is given, the snapshot is bassed to the RDS Construct. This leads to a replacement of the database (which is fine).
Now, if the database has been recovered from snapshot and I do some other update in the CDK Project and want to update the project (which is done via CD Pipeline) I usally start the update without giving any snapshot. This leads to the database to be replaced by an empty one, which is of course not what I want.
To summarize, this is how it currently works:
Current state of the stack | Deployment Paramter | Result |
---|---|---|
Not created from snapshot | No snapshot | DB is not replaced |
Not created from snapshot | snapshot | DB is replaced |
created from snapshot | No snapshot | DB is replaced |
created from snapshot | snapshot (same) | DB is not replaced |
created from snapshot | snapshot (different) | DB is replaced |
This is IMHO not managable.
But what I want is something like this:
Current state of the stack | Deployment Paramter | Result |
---|---|---|
Not created from snapshot | No snapshot | DB is not replaced |
Not created from snapshot | snapshot | DB is replaced |
created from snapshot | No snapshot | DB is not replaced |
created from snapshot | snapshot (same) | DB is replaced |
created from snapshot | snapshot (different) | DB is replaced |
Or, to put it in other words:
- If I specify no snapshot, don't replace the DB
- If I specify a snapshot, repalce the DB
Is this possible? Or is there another good way to manage an RDS Database using CDK?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论