Karthik
Karthik

Reputation: 349

How to convert existing AWS environment into infra as code?

When we were building our AWS account, we did not think about using cloud formation or terraform. Now we have our environmemt all setup but don't want to tear down everything and build using cloud formation or terraform. So is there a way we can get our infrastructure to be imported and managed through one of them?

Thanks,

Upvotes: 2

Views: 3383

Answers (4)

inertia
inertia

Reputation: 404

In case you are looking to import your existing AWS Infrastructure into Terraform, you can give a try to a tool that we recently launched - https://www.kapstan.io/generate-terraform

Upvotes: 0

Exequiel Barrirero
Exequiel Barrirero

Reputation: 5868

A pretty complete answer could be found at AWS Export configuration as cloudformation template, which also covers Terraform for this purpose.

TL;DR

AWS Import/Export configuration as code (CloudFormationn | Terraform).

Based on our Infrastructure as Code (IaC) experience we found several ways to translate existing manually deployed (from Web Console UI) AWS infra to Cloudformation (CF) and / or Terraform (TF) code. Posible solutions are listed below:

AWS Cloudformation Templates

Terraform Code / Modules


Related Article: https://medium.com/@exequiel.barrirero/aws-export-configuration-as-code-cloudformation-terraform-b1bca8949bca

Upvotes: 1

Dennis
Dennis

Reputation: 799

As per October 2019, AWS supports importing legacy resources into CloudFormation. See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html for examples.

Upvotes: 0

Anshu Prateek
Anshu Prateek

Reputation: 3055

Terraform supports import, but that only supports the present state into state file. You still need to write the code. Cloudformation does not support import.

Something like https://github.com/dtan4/terraforming can be of help but YMMV.

Upvotes: 4

Related Questions