如何管理RDS数据库,包括从CDK中的快照恢复

发布于 2025-02-01 15:25:33 字数 1337 浏览 3 评论 0原文

我正在管理CDK项目中管理RDS数据库。从快照中恢复数据库的旧状态是必要的。

为了实现这一目标,我有CDK上下文参数指定应从中恢复数据库的快照。如果给出,快照将低音到RDS构造。这导致替换数据库(很好)。

现在,如果数据库已从快照中恢复,并且我在CDK项目中进行了其他一些更新,并希望更新项目(通过CD Pipeline完成),我将其用通常启动更新而无需提供任何快照。这导致数据库被一个空的数据库取代,这当然不是我想要的。

总而言之,这就是当前的工作方式:

堆栈部署参数
当前状态未从快照中创建的没有快照DB所产生的未替换,
未从快照DB创建的Snapshot快照db中替换
从快照中创建的no Snapshot替换
DB,从Snapshot SnapshotSnapshot(相同) (相同) )
用快照快照(不同的)DB替换DB,

这是IMHO无法管理的。

但是我想要的是这样的:

堆栈部署参数结果
的当前状态未从快照中创建的没有快照的未替换
DB所产生了没有Snapshot DB创建的Snapshotdb
而不是从快照快照db中创建的,从快照中创建,no snapshot替换
snapshot snapshotsnapshot(相同)(相同) )替换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 stackDeployment ParamterResult
Not created from snapshotNo snapshotDB is not replaced
Not created from snapshotsnapshotDB is replaced
created from snapshotNo snapshotDB is replaced
created from snapshotsnapshot (same)DB is not replaced
created from snapshotsnapshot (different)DB is replaced

This is IMHO not managable.

But what I want is something like this:

Current state of the stackDeployment ParamterResult
Not created from snapshotNo snapshotDB is not replaced
Not created from snapshotsnapshotDB is replaced
created from snapshotNo snapshotDB is not replaced
created from snapshotsnapshot (same)DB is replaced
created from snapshotsnapshot (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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文