🚀 Write CDK faster: Integrating Amazon Q with VS Code and my first impression

Mithun Das
4 min readDec 13, 2023

--

Well, this article was not in my todo list. While I was writing my other article on processing large scale sentiment analysis using AWS Step function distributed map, I decided to try out Amazon Q which is in preview. AWS announced Q few weeks ago in 2023 re:invent.

Amazon Q

  • Amazon Q is a generative AI assistant specifically designed for the workplace.
  • It uses its AI capabilities to access and process information from your company’s data and systems, like code, documents, and enterprise applications.
  • This allows Q to answer your questions, solve problems, generate content, and even take actions on your behalf.

I have asked Q about the application I stated working on and I am very impressed with the detail Q provided.

Set it up

Honestly, setting up Amazon Q is super simple and straightforward.

Open VS Code Marketplace and search for “AWS Tookit”. Click install and follow the on-screen prompts. You need to have AWS Builder ID which you can create for free.

Amazon Q + CDK: A Match Made in Developer Heaven

  • Generate CDK constructs: Stuck on the perfect CDK construct for your task? Ask Q! It can suggest relevant constructs and even generate boilerplate code based on your requirements.
  • Optimize your infrastructure: Unsure about the best configuration for your resources? Q can analyze your CDK code and suggest improvements based on best practices and cost optimization strategies.

Pricing

Well, when it comes to AWS, pricing is complicated :)

If I am reading it correct, Amazon Q conversational coding comes free under individual tier. But this does not include all the capabilities of Q. To get all the features you need to pay.

During preview you can explore the features for free. Then two simple pricing models

  • Business $20/mo/user
  • Builder $25/mo/user

It’s twice as Github copilot (though it’s not a proper comparison) So I need to figure out if Amazon Q is worth paying while it’s very specific to AWS.

First Impression

When I watched it in reinvent, it was super impressive. So, once I got it setup in VS code, I started exploring different things. First of, I asked if it can help me remove hardcoded values. It was spot on including what library to import and how to configure.

Then I asked to wrote CDK code to create a s3 bucket, a queue and send a message to the queue when new object is created in the bucket. The generated code was partially correct with some compilation error. When I asked about the error, Q were unable to resolve the issue for me.

In another workspace, I asked Q to tell me about the project looking at the code. The response was quite impressive.

Then I asked to write another CDK code — this time more complicated — I asked to create an event bridge rule to trigger a state machine (step function) when an object is created in a s3 bucket. Like previous code, it generated code which did not compile but this time Q was able to resolve the issue when I mentioned the error.

There are lot of other features available to explore under preview for free which included code transformation such as java 17 project upgrades, feature development etc. I am yet to explore those.

Overall, Q seems very promising and useful — it will only get better over the time.

What’s your experience so far? Have you have any tips & tricks to share?

--

--

Mithun Das

Sr Principal Engineer | Designing & Building Softwares for 20 years