DEV Community

Girish Mukim
Girish Mukim

Posted on • Updated on

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

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

Step 3: Choose Mutating from drop down for Type and click checkbox for actions you would like to include in your code.

select-actions

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 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.

choose YAML

Here you go, your code template is ready. You can copy or download the code.

final code

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
- CDK Java
- CDK Python
- CDK TypeScript
- CloudFormation JSON
- CloudFormation YAML 

Enter fullscreen mode Exit fullscreen mode
  • 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 annoucement HERE and AWS documentation HERE.

If you prefer video tutorial, please refer

Top comments (0)