简体   繁体   English

如何将 AWS 资源转换为 cloudformation 堆栈或模板?

[英]How to convert AWS resources to a cloudformation stack or template?

I have a bunch of AWS resources (ec2 instances, rds, s3, etc.)我有一堆 AWS 资源(ec2 实例、rds、s3 等)

Those resources were created manually over the years in AWS console.这些资源是多年来在 AWS 控制台中手动创建的。

Now I would like to duplicate this environment using CloudFormation.现在我想使用 CloudFormation 复制这个环境。 What is the best approach?最好的方法是什么? Is there a tool, that converts all the resources into a cloudformation stack or template?是否有工具可以将所有资源转换为 cloudformation 堆栈或模板?

I couldn't find anything, or maybe I didn't understand the process correctly...我找不到任何东西,或者我没有正确理解这个过程......

There was a service named CloudFormer that could perform this action but has since become deprecated.有一个名为 CloudFormer 的服务可以执行此操作,但此后已被弃用。

Functionality does exist within CloudFormation to create a stack from existing resources . CloudFormation 中确实存在从现有资源创建堆栈的功能。

However, to use this you will want to design the stack to use the same options and setup as your resources.但是,要使用它,您需要将堆栈设计为使用与资源相同的选项和设置。 Once this is completed you could then manage these resources via CloudFormation.一旦完成,您就可以通过 CloudFormation 管理这些资源。

More information is available in the Import Existing Resources into a CloudFormation Stack blog post.现有资源导入 CloudFormation 堆栈博客文章中提供了更多信息。

You could potentially try the AWS Console Recorder extension for Chrome/Firefox which supposedly could create CloudFormation templates based on your AWS Console clicks.您可能会尝试使用适用于 Chrome/Firefox 的AWS 控制台记录器扩展程序,据称它可以根据您的 AWS 控制台单击创建 CloudFormation 模板。

From their README:从他们的自述文件中:

Records actions made in the AWS Management Console and outputs the equivalent CLI/SDK commands and CloudFormation/Terraform templates.记录在 AWS 管理控制台中执行的操作并输出等效的 CLI/SDK 命令和 CloudFormation/Terraform 模板。

Caveat: Not all resources are supported .警告: 并非所有资源都受支持

These days you would use a third party, free and fully open-source tool called former2 developed by renovated AWS Hero .这些天来,您将使用由经过翻新的AWS Hero开发的名为former2的第三方、免费且完全开源的工具。 The former2 is used by corporate clients of AWS as explained in the AWS blog post .AWS 博客文章中所述, former2由 AWS 的企业客户使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM