If you couldn't make it to AWS re:Invent this year, you can watch all of the presentations on the AWS YouTube channel. My talk was about using the AWS Toolkit for Eclipse to develop and deploy a simple meme generation app.
The application uses a common AWS architectural design pattern to process its workload and serve content. All the binary image data is stored in an Amazon S3 bucket; the image metadata is stored in Amazon DynamoDB; and the image processing jobs are managed using an Amazon SQS queue.
Here's what happens when a customer creates a new meme image:
- The JSP page running in AWS Elastic Beanstalk asks Amazon S3 for a set of all the images in the bucket, and displays them to the customer.
- The customer selects their image and a caption to write onto it, then initiates a post.
- The JSP page inserts a new item into DynamoDB containing the customer's choices, such as the S3 key of the blank image and the caption to write onto it.
- The JSP page inserts a message into the SQS queue containing the ID of the DynamoDB item inserted in the previous step.
- The JSP page polls the DynamoDB item periodically, waiting for the state to become "DONE".
- A back-end image processing node on Amazon EC2 polls the SQS queue for work to do and finds the message inserted by the JSP page.
- The back-end worker loads the appropriate item from DynamoDB, downloads the blank macro image from Amazon S3, writes the caption onto the image, then uploads it back to the bucket.
- The back-end worker marks the DynamoDB item as "DONE".
- The JSP page notices the work is done and displays the finished image to the customer.
Several customers in attendance expressed interest in the source code for the application, so we have released it on GitHub. It takes a little work to set up, mostly because you need to add the SDK and its third-party libraries to the project's classpath. Follow the instructions in the README file, and please let us know how we can improve them!