This week, Metal Toad had its bi-annual Hackathon. The theme of this hackathon was to choose a repository from AWS Samples, implement it in our environment, and then to expand upon it. The Idea behind this is that many of these examples and templates can help accelerate projects for Metal Toad’s customers by providing a 50-80% solution which can then be customized and made production-ready.
I was part of a team called Media Something, and we found a sample repository of an AWS Workshop that demonstrated how to set up MediaLive, MediaPackage, and MediaTailor. We learned a lot about those, but the most interesting thing I learned was in using Amazon Q Developer to convert and update the code.
Why would I want to convert the code? Most AWS Sample repositories have IaC that use Cloud Development Kit (CDK), or Serverless Application Model (SAM). Both work well and have their own pros and cons. However, at Metal Toad our default IaC tool is Terraform. As part of the hackathon I wanted to see how hard it would be to convert the CDK into Terraform.
To help with this, I leveraged Amazon Q Developer’s /dev
feature. For those of you who aren’t familiar. In your IDE Amazon Q Developer plugin, you type /dev “describe a feature or task”
You have 4000 characters to describe what you would like to make. Amazon Q Developer evaluates what you want, scans all the files in the current workspace, documents what needs to be changed, and proposes changes to the code. After that you can review and accept, or ask for refinement.
This is not necessarily a quick process. Depending on the size of the workspace and the request, I’ve seen this take 5-30 minutes and I’m sure it could go higher.
I asked it to “/dev review the CDK code in the repository. Create terraform to complete the same task with roughly the same structure.”
The result? I got beautifully structured code—no syntax errors, proper directory structure, and all the necessary objects. But it couldn’t deploy.
The code looked good but there were small differences: extra underscores in a word, a slightly out of place parameter. It took reading through the code object by object to find the little mistakes and correct them.
Still, it was a huge success. In about 4 hours, I was able to get terraform scripts for services I hadn’t previously deployed with IaC. Without Amazon Q Developer this probably would have been a few days to create, and If it were with resources I’m familiar with, it would have been even faster.
This hackathon proved to me that AWS Sample Repositories are an excellent starting point, even if the code is in a format or language you’re not familiar with, and that Amazon Q can be used to help the transition between familiar and unfamiliar IaC systems