Using Amazon Q Developer and ChatGPT to build solutions on AWS
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.?
I decided to try to implement this prospective client request before even closing the deal with Amazon Q Developer, IntelliJ, and ChatGPT.?
I went over to ChatGPT and asked ChatGPT,? “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 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.
After you install, you’ll be prompted to login with your AWS account. I chose the “Use for free” button.
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 create a new user on my 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.
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. Low and behold, my pom.xml got updated from Java 11 to 17.
Pretty cool, so I got greedy.?
Next, I asked for Amazon Q Developer to generate a REST API that enables me to deposit an audio file to an S3 bucket.?
Voila! I got a brand new Service, Controller, and S3Config file. 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 asked 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. PutObjectAsync may be a better choice here.
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 AWS Q Developer. If you have any issues getting it to work, reach out to AllCode, and we’ll get you going!
Engagement Manager, Professional Services | Project Management
1 个月Love to see the trial and error and gradual success!