MMS • Renato Losio
Article originally posted on InfoQ. Visit InfoQ
AWS recently introduced Console-to-Code, offering a new capability to transform actions executed in the console into reusable code for AWS CDK and CloudFormation. This generative AI feature is currently in preview, supporting only Amazon EC2, and provides a guided path for creating resources and testing prototypes.
Designed to get started with automation code, Console-to-Code records all the actions and generates code in different infrastructure-as-code (IaC) formats: the service currently supports outputs for the CDK (in Java, Python, or TypeScript) and CloudFormation, both JSON and YAML. The documentation warns:
You then use the code as a starting point for your automation scripts. You’ll need to validate that the code meets your intent and that the parameters will configure your resources as expected. You’ll need to customize the code to make it production-ready for your use case. Once you’re satisfied with the code, you can use it in your automation scripts.
The cloud provider released an animation to showcase how to generate code using Console-to-Code in the EC2 console. David Jennings, Python developer and DevOps engineer, comments:
Oh God, this is going to make my life so much easier. It’s been a long time since I’ve genuinely been excited about a new AWS thing.
Matt Lloyd, technical lead at Thoughtworks, adds:
This is exactly what I was hoping AWS would create. Console to code, so your console actions can be converted to CDK. So many teams struggle with infra as code, so revert to the console. Now you can have the best of both worlds. Excited to play with this!
In the “Console-to-Code Preview: Test Drive, Bright Future” article, Jon Holman, solutions architect at Groundswell, considers different use cases for the new product:
Using this tool, newcomers can more easily adopt the best practice of using Infrastructure as Code (IaC). This tool can even help seasoned IaC professionals create new templates while adding rarely used resource types.
The ability to generate code for console actions gained positive reactions in the community, but the limited scope of the preview raised some doubts. Holman writes:
I thought creating an EC2 instance with all default settings except my key pair would be a simple test of this new feature. However, after needing to fix the provided template over six iterations to deploy successfully, I conclude that this feature is unfortunately not ready to be used. It is fun to play with, though. I understand this feature is still in preview, but what can this current version successfully do? The current version is limited in scope to the EC2 console. In the EC2 console, what is more fundamental than creating an EC2 instance?
Based on generative AI, Console-to-Code is still in preview and supports a maximum of 5 actions for a single transformation. The feature is limited to the Amazon EC2 console and only available in the Northern Virginia region. There are no additional costs for using it.