In their eagerness to launch a cloud initiative, there are still organizations that deploy new environments and resources from the AWS console. While they may believe it leads to a quick win, the reality is different.
Background
I spoke with an organization recently that had deployed all of their AWS resources from the console. I was asked if there was a way to export the settings of a given resource to serve as a reference or backup should a similar resource ever need to be setup again. We talked a bit about Infrastructure-as-Code (IaC) principles, about Terraform, CloudFormation, and they understood IaC’s importance. However, with limited time, we addressed the question using AWS’s IaC Generator.
What is AWS’s IaC Generator
The IaC Generator, accessible within the CloudFormation service dashboard, is primarily designed for use with manually provisioned resources. It enables you to generate CloudFormation templates based on existing AWS resources, which can then be imported into CloudFormation for efficient resource management using IaC principles.
Running IaC Generator
The IaC generation process has (3) high-level steps:
- Scan for resources – Scans your AWS account to discover what resources have been deployed
- Create a template – Once the scan completes, you can create CloudFormation templates to include selected scanned resources. IaC Generator can generate JSON or YAML templates.
- Import – Import the resources into CloudFormation
Now the screenshots!!! (from the console, but this is how we walked through the process)
- In the AWS Console, open the CloudFormation dashboard and click IaC generator. Then click Start a new scan to discover the resources in your account.
2. The scan make take a few moments, but the Scan status will read Complete when it has finished.
3. Just below the Scans box, you should see a Templates box. Within it, click Create template.
4. On the Specify template details page, select the appropriate option for Prepare Template. In this case, we are starting from a new template. Then enter a Template name and set the Deletion and Update replace policy. Click Next.
5. On the Add scanned resources page, select the resources you wish to add to the template and click Next.
6. If there are any resources related to those you selected, they will be listed on the Add related resources page. For example, if you selected to import a “VPC”, you would likely see pages of resources related to that VPC on this screen. Click Next to continue.
7. On the Review and Create screen, click Create Template. IaC generator will begin to build the CloudFormation template…this may take a few moments. Once completed, you will have the option to Import to stack.
In my case, all I really wanted was the template, go I clicked Download and thus the client had the resource settings configuration they wanted.
Conclusion
Though my personal preference is to use Terraform to create cloud-based resources, the AWS IaC Generator was extremely helpful in this case. If you have deployed AWS resources manually through the console, IaC Generator can simplify the process of creating templates to import your existing resources to enhance the management experience of your AWS resources with the introduction of IaC principles.