a

Using Amazon Q Developer and ChatGPT to build solutions on AWS

Amazon Q Developer AllCode

Last week, a prospective client came to us asking if the following was possible on AWS.

To use an API to transcribe an audio file and apply audio intelligence.

1. Maintain high security and compliance.

2. Ability to transcribe audio files to text (Speech to text)

3. Automatically detect and redact PHI in the audio file and transcription

I decided to try to implement this prospective client request before even having the deal with Amazon Q Developer, IntelliJ, and ChatGPT

I typed intoChatGPT

  how to build the following with AWS ” + ${above requirements}. 

ChatGPT responded with

1. Security & Compliance
- Store audio and text in Amazon S3 with KMS encryption.
- Use CloudTrail to log access.
- Lambda deletes files after processing.

2.Transcribe Audio to Text
- Use Amazon Transcribe for speech-to-text.

3.Detect & Redact PHI
- Use Amazon Bedrock (Claude or Titan) to detect and remove PHI.

Nice. I would have come up with the same blueprint, but ChatGPT validated the blueprint that I had in my head.
Now, the tricky part, how do I get AI to generate the code to do this?

I don’t get to write code much anymore. I get a couple of hours per week to code if I’m lucky,  but I still hold onto my annual “All You Can Eat” JetBrains subscription for IntelliJ, PyCharm, and DataGrip.

Installation

I fired up IntelliJ, and started to follow this YouTube video put together by Amazon on Amazon Q Developer.

The YouTube video was helpful, but I got stuck quickly. I was able to launch IntelliJ and install the Amazon Q Developer Plugin by navigating to Settings\Plugin.

Amazon Q Developer IntelliJ Plugin Installation

After you install, you’ll be prompted to login with your AWS account. I chose the “Use for free” button.. 

Amazon Q Developer IntelliJ Plugin Login

Amazon Q stated that it was trying to launch a browser to authenticate, but the browser never popped.  Frustrating. 

At the bottom of IntelliJ, I noticed that the plugin was complaining about errors in my ~/.aws/config file. I’m on a Mac, I’ve used the AWS CLI to access profiles for at least 15 clients. Yuck.

I initially tried to clean up the AWS config, credential, and sso files, but no luck.

Next, I opted to literally create a new user on Mac and start from a clean slate. Starting from a clean slate required me to switch over to the new account and re-install the Q Developer Plugin. This time when I clicked on “Use for Free”,  Safari popped open and I was able to login. Progress.

Modernization

Amazon Q Developer can not only be used for generating new code, but it can also be used to address technical debt. Hmm, I wonder if Q Developer can update a Java 11 to Java 17 project? 

I created a shell Java project in IntelliJ. I told Amazon to

/transform the project from Java 11 to Java 17.

Lo and behold, my pom.xml got updated from Java 11 to 17.
Amazon Q Developer Upgrade Java 11 to Java 17

Pretty cool, so I got greedy. 

Code Generation

Next, I asked for Amazon Q Developer to

generate a REST API that enables me to deposit an audio file to an S3 bucket. 

Amazon Q Developer Upload a file to S3

Voila! I got a brand new Service, Controller, and S3Config file in my project.. The uploadAudioToS3 function even comes with MultipartFile support out of the box so it can handle large files. Exception handling is built in. Wow.

Let’s go for a little more. I ask Amazon Q Developer to

launch the Transcription job after the file has been successfully uploaded to S3.

The StartTranscriptionJobRequest gets built into the AudioService and gets invoked right after the file gets uploaded.

Amazon Q Developer Transcribe Audio

Now, the only problem is my project won’t compile. 🙂 Something got screwed up with my pom.xml or classpath. I’ve spent my hour trying to build this. I’ve seen the light.

If you’re working on AWS and you want to move faster, start using Amazon Q Developer. If you have any issues getting it to work, reach out to AllCode, and we’ll get you going!