logo

AWS Introduces Console-to-Code (Preview): Here is Your Step-by-Step guide !

With console-to-code, AWS uses generative AI capabilities to convert our actions on the EC2 console into code.

Published Jan 28, 2024
Last Modified Jan 29, 2024
Imagine this: you're doing stuff on AWS Management Console, and magically, some angel understands everything you do. It hands you a CloudFormation template at the end, making your next project a breeze to kick off. Sounds like a wish, right? Well, a few months ago, it was just that – a wish. But guess what? Not anymore!
Amazon Web Services (AWS) has introduced AWS Console-to-Code in preview – a super-cool GenAI powered tool that turns what you do on the AWS Management Console into real code for your projects. With Console-to-Code, you can convert your console moves into reusable code. No more choosing between clicking around on the console and writing code – this tool gives you the best of both worlds.
Please note that the feature is currently in preview and has limited capabilities. We'll also understand its current limitations.
Let's bring the console-to-code feature in action!
Step 1: Login to your AWS management console and navigate to EC2 service
Ensure you choose us-east-1 region (P.S. first limitation) and Lauch EC2 instance. I won't go into details of lauching EC2 instance. You can refer documentation HERE
Step 2: You will find new option in left panel "Console-to-Code". Click that.
console-to-code
Console-to-Code
Step 3: Choose Mutating from drop down for Type and click checkbox for actions you would like to include in your code.
mutating-non-mutating
Action Types
The options for drop down for Type are "Show all", "Show mutating", and "Show read-only".
Let me show you what you see when you choose "Show all"
show-all
show-all-actions
One observation is that, read-only actions flow to console-to-code page right away but mutating actions take few minutes. So be patient. I've repeated steps once, thinking the feature didn't work somehow :-). Anyway, let AWS take it's time to get all the actions in console-to-code page.
Step 4: Once you select action, "Generate {code} code" will be clickable. Choose your choice of code format from drop down.
generate-code
generate-code
Here you go, your code template is ready. You can copy or download the code.
code-template
code-template
Step 5: Use the code as a starting point for your infrastructure-as-code. You'll need to customize the code to make it production-ready for your specific use case.
Please note that only actions taken during the current session are listed. Actions taken during previous sessions are not retained. Also you can choose only 5 actions at a time.
[P.S. Second limitation]
Let's understand limitations of Console-to-Code feature of EC2.
  • Currently only region supported is US East (N. Virginia).
  • Supported code formats
1
2
3
4
5
- CDK Java
- CDK Python
- CDK TypeScript
- CloudFormation JSON
- CloudFormation YAML
  • You can only choose 5 actions to include in your code file.
I have to make changes to make the code usable, so it's not perfect, but it's definitely a promising start to put generative AI capabilities to work. I hope the tool improves as people start using it and provide feedback to AWS. I also wish Console-to-Code will not be restricted to EC2 alone. Anyway it will be interesting to see how this feature evolves.
Check AWS feature announcement HERE and AWS documentation HERE.
If you prefer video tutorial, please refer