DEV Community

Girish Mukim
Girish Mukim

Posted on • Edited on

1

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

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay