An overview of the IaC Generator feature for CloudFormation, released in February 2024.
Situation
One of the top benefits of VMware Cloud on AWS is the ability to augment workloads with native AWS services. One of my jobs on the VMware Specialist SA team here at AWS is to build lab content demonstrating integrations between native AWS services and VMware Cloud on AWS. We use these demonstrations in our Immersion Day Workshop to give customers hands-on access to these integrations.
CloudFormation is Amazon's Infrastructure-as-Code tool. Any resource that needs to be made available to a customer in a workshop needs to be created using CloudFormation. I create this code in many different ways. Sometimes I find code that another team has built for a similar purpose and can re-use it. Other times I have a pretty good handle on what I need to do and start coding immediately in VS Code, letting CodeWhisperer help me generate code as I go. Sometimes it's a brand new service, or a brand new area of a service for me, and I will ask Amazon Q to help me start from scratch.
Regardless of how I eventually generate the code, I almost always create resources by hand before I start trying to automate, particularly if the service I'm working with is new to me. You need to fully understand what you're building before you try to automate it. When I saw the release announcement for AWS IaC Generator, I knew I had to try it out right away. IaC Generator can see resources you create in your account, and will generate the necessary CloudFormation code to recreate those resources. I expect testing to demonstrate that the new feature will speed up my development cycle by automating what I build by hand.
Task
Test IaC Generator by pointing it to resources I already have in one of my accounts.
Actions
-
You can find the link to IaC inside the CloudFormation section of the console
-
Scan the resources in my account. This can take some time.
Scan in progress...
Scan complete!
-
Now that all of the resources in my account have been scanned, I create a new CloudFormation template.
-
I name my template.
-
I want to generate code for an EC2 instance and related resources. All scanned resources found in my account are listed here. I search for my EC2 instance ID and find my instance in the list of resources.
-
IaC generator automatically finds related resources. It found my instance's volume, VPC, network interface, subnet, and security group!
-
Template generation is complete
-
I now have a CloudFormation template that I can run to re-create the resources that I built manually in my account. Here is a snippet of the Security Group code that IaC generated.
Results
IaC Generator will significantly speed up my development cycle as I introduce new integrations in our our Immersion Day workshops. I have to create the resources I need by hand, which is a step I am doing anyway as part of testing. IaC Generator then builds the code I need automatically!