Moshe Shaham
Moshe Shaham

Reputation: 15974

How to convert AWS resources to a cloudformation stack or template?

I have a bunch of AWS resources (ec2 instances, rds, s3, etc.)

Those resources were created manually over the years in AWS console.

Now I would like to duplicate this environment using CloudFormation. What is the best approach? Is there a tool, that converts all the resources into a cloudformation stack or template?

I couldn't find anything, or maybe I didn't understand the process correctly...

Upvotes: 8

Views: 5253

Answers (4)

csaju
csaju

Reputation: 394

You can use IaC Generator that scans your account to find existing resources. Then it generates cloudformation templates for managing those resources. Here are the step by step on how you can proceed.

  • Go to CloudFormation
  • Select IaC generator
  • Scan resources
  • Create template choosing which resources you want.

Ref: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/generate-IaC.html

Upvotes: 1

Marcin
Marcin

Reputation: 238081

These days you would use a third party, free and fully open-source tool called former2 developed by renovated AWS Hero. The former2 is used by corporate clients of AWS as explained in the AWS blog post.

Upvotes: 5

Nick
Nick

Reputation: 1273

You could potentially try the AWS Console Recorder extension for Chrome/Firefox which supposedly could create CloudFormation templates based on your AWS Console clicks.

From their README:

Records actions made in the AWS Management Console and outputs the equivalent CLI/SDK commands and CloudFormation/Terraform templates.

Caveat: Not all resources are supported.

Upvotes: 1

Chris Williams
Chris Williams

Reputation: 35146

There was a service named CloudFormer that could perform this action but has since become deprecated.

Functionality does exist within CloudFormation to create a stack from existing resources.

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.

More information is available in the Import Existing Resources into a CloudFormation Stack blog post.

Upvotes: 0

Related Questions