Ricardo Sueiras
Posted on November 28, 2024
Doing live demos and coding is one of the most fun (if a little nerve wracking) parts of the job of a developer advocate. I have been doing a series of talks called "From Zero to shipped in 30 minutes" where I start with nothing but a blank IDE, and then attempt to build a working application in the allotted time.
Frequently I want to get feedback, input, or ideas from the audience. Tonight was a good example, I decided I would try and build a Wish List web application - it is coming up to Christmas after all, and it was top of mind. I wanted to get some audience participation, asking them to provide me with some links that I could use to test the app out (and maybe even get some good ideas in the process!)
There are many ways I could has asked attendees to provide that, but they all seemed very inefficient. I was thinking about this on the train journey to the event, and decided I would try and build something their and then. This blog posts outlines how I built a very simple, but effective too to help with audience participation. It is a good start, and I will try and build upon it with new features. Of course this was all possible thanks to my good friend and trust companion, Amazon Q Developer.
Using /dev to build the application
As this was going to be a simple application, I decided I would use Amazon Q Developer Agent for software development to create the initial code. I came up with the following outline of a prompt that I supplied to Amazon Q Developer via the chat interface:
I want to create a simple application that I can capture audience feedback in real time. It must
- use a Python web framework (do not use Django)
- provide a feedback link that uses a simple web interface to allow people to submit a simple message
- generate a QR code so that I can share the feedback link
- provide a messages screen that displays all the messages that people have submitted
- capture messages in a local json file that is loaded/updated as the application is stopped or started
After about 6 minutes, I have some very decent code that provides a homepage that displays a QR code, and then a separate message screen for entering feedback. After installing the requirements (/dev automatically created this for me) I had the application up and running. After a quick test to make sure it worked as intended, I realised I wanted to make a few improvements.
Improving the initial code
The first improvement was to optimise it for mobile devices. Opening up the relevant file (message.html and feedback.html), I used the following prompt in the Amazon Q Developer chat interface:
Optimise the code for mobile devices
Repeating this prompt against both those html pages resulted in much improved code that looked way better.
After testing the application I was ready to deploy it.
Deploying this to AWS
I did not want to over engineer the deployment - I needed something quick and simple. When I asked Amazon Q:
What is the easiest way to deploy this on AWS
I was guided towards deploying this using AWS AppRunner. If you are not familiar with AWS AppRunner, it is one of the simplest ways of running containerised application. I followed up with some additional prompts, such as
- Create a Dockerfile for this application
- Create a script that will build and push a container image to Amazon ECR
- Provide step by step guide on using AWS AppRunner to deploy this
And I was quickly helped in creating an ok Dockerfile*, a script that took care of all the heavily lifting (build.sh) and before long, I had the application up and running on AWS AppRunner.
*I did encounter the issue with my initial attempt in that as I was building these locally on my Arm based Macbook M1, the containers would fail as AWS AppRunner does not appear to support Arm based container images. Luckily in 2 seconds Amazon Q told me how to fix this.
I have a hosted DNS zone on Amazon Route 53, and this made it super simple to hook up a custom domain to the feedback application.
Automated updates
I had to make a few changes to the code, and every time I updated the container image via the script, AWS AppRunner would automatically redeploy the latest version. This was super awesome, especially when I was hotspotting of my iPhone when trying to do this.
Conclusion
That's all folks, in this blog post I walked you through how you can develop a simple tool to collect feedback from your audience, in less time than it took for my train to arrive at its destination. I love the way that Amazon Q Developer allows you to build anything in such a short amount of time.
If you want to try this for yourself, you can grab the code at the GitHub Repo here
You can try Amazon Q Developer for free today, by signing up for a Builder ID. You can also check out my other posts on community.aws, as I have been sharing a lot of tips and use cases of how I am using Amazon Q Developer. You can also keep up to date with all the new features and improvements of Amazon Q Developer by checking out the changelog.
Posted on November 28, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 20, 2024