从现有 RDS 数据库实例 (Aurora PostgreSQL) 创建 CloudFormation Yaml

Create CloudFormation Yaml from existing RDS DB instance (Aurora PostgreSQL)

我的 AWS 账户中设置了一个 RDS 数据库实例 (Aurora PostgreSQL)。这是使用 AWS 控制台手动创建的。我现在想为该数据库创建 CloudFormation 模板 Yaml,我可以在以后需要时使用它来创建数据库。这也将帮助我在另一个环境中复制数据库。我还将其用作我的基础设施自动化的一部分。

遗憾的是,AWS 没有提供此类功能

但是,您的意思是听说人们可能错误地推荐了两个选项。

CloudFormer

CloudFormer is a template creation beta tool that creates an AWS CloudFormation template from existing AWS resources in your account. You select any supported AWS resources that are running in your account, and CloudFormer creates a template in an Amazon S3 bucket.

虽然听起来不错,但该工具不再维护并且不可靠(多年处于测试阶段)。

Importing Existing Resources Into a Stack

人们常常错误地认为这 "generates yaml" 适合您来自现有资源。事实上,它 不会为您生成模板文件 。在将受控的任何资源导入 CloudFormation 堆栈之前,您必须编写与您的资源完全匹配的模板。

您唯一的选择是为 RDS 手动编写模板 并导入它,或者寻找可以从现有资源对 yaml 模板进行逆向工程的外部工具。

您可以使用 former2 生成现有基础架构的 CloudFormation 模板(json 和 yaml)。免费使用。 https://github.com/iann0036/former2