Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

#CloudGuruChallenge: Improve application performance using Amazon ElastiCache

Gain the AWS and Python skills needed to implement a database cache using Redis (and get swag/a LinkedIn endorsement) with this month's #CloudGuruChallenge.

Jun 08, 2023 • 4 Minute Read

Please set an alt value for this image...

What’s the #CloudGuruChallenge? Get some more info over here.

Challenge TopicImprove application performance using Amazon ElastiCache
Challenge CreatorDavid Thomas
Challenge GoalImplement a Redis cluster using Amazon ElastiCache to cache database queries in a simple Python application.
Challenge OutcomeGain AWS and Python skills needed to implement a database cache using Redis.
Challenge DeadlineJuly 31, 2021 

Prerequisites

AWS Free Tier account

Python

Github (Optional)

  • https://github.com/
  • The application code will be stored on GitHub, but no account is required for read-only access.

The Challenge Steps

Database

  • Deploy an RDS PostgreSQL database instance. The free tier db.t2.micro instance should be plenty.
  • You should also create a database and database user account.  You will need these when configuring the application.
  • Bonus points if you deploy the Amazon RDS instance using a CloudFormation or Terraform template.

Application

  • Deploy an EC2 instance. Again, the free tier should be sufficient,
  • Install python3 along with the psycopg2, flask, configparser and Redis modules.
  • Configure the application to connect to your database instance as instructed in the README.md and give it a test run.  
  • Access the page a few times and make note of the page load times.
  • Please note, the stored procedure called by the application has been artificially slowed to represent an under-provisioned database server. The goal of this challenge is to add a cache in front of the database, not to optimize the stored procedure.

Cache

  • Deploy ElastiCache Redis cluster.  This can be done manually or automated using your choice of tools and templates.
  • Ensure that the Redis cluster is only accessible from the application EC2 instance.
  • Alter the application, check the Redis cache before querying the database. If a cache miss occurs, query the database and update the cache with the results.
  • Give the patched application a test run. Make sure to access the page multiple times making note of the runtime.

Blog Post

  • Write a short blog post explaining your learnings and your approach to the challenge. Be sure to include why you took the challenge, what your biggest takeaways are, and the pre- and post-cache page load times.
  • If you don't have your own blog, Hashnode or dev.to are great places to start.

When You’re Done

You can complete the project requirements by yourself or in collaboration with others. Feel free to ask questions in the ACG Discord server (there’s a specific channel for this challenge) or on social media using the #CloudGuruChallenge hashtag!

When you finish all the steps of the project, post a link to your blog post in the designated Discord channel. I will then be able to endorse you on LinkedIn for the skills you demonstrated in this project: Amazon ElastiCache, Python. You’ll also be entered to win some cool swag and get a special shoutout from the A Cloud Guru LinkedIn account after the challenge! 

This challenge will remain available indefinitely, but to get endorsed on LinkedIn, win swag, and get a shoutout on LinkedIn you need to submit your challenge on Discord by July 30, 2021.

Most importantly, the #CloudGuruChallenge is FREE and available to everyone! 

Resources

Be prepared to do some Googling, but if you are an ACG member, here are some resources that can help you get more comfortable with Python and AWS:

If you aren’t already an ACG member, we encourage you to sign up for a free account (no credit card required) to get started and explore a selection of free courses that are rotated each month. 

Extra-Challenging Steps

You don't need to perform these additional steps to “declare victory” on the challenge, but they will help your project stand out and provide awesome additional learning.

  • Create a PR on github
    •  Create a Pull Request on GitHub with the changes you made.
  • RDS instance as code
    • Deploy the RDS instance using a CloudFormation or Terraform template to define the instance as code.

Final Takeaways

While the application used for this challenge was intentionally made slow, the skills learned completing this challenge are also useful for real-world applications. 

It's not always possible to tune the database for optimum performance — for instance, when using a third-party application that doesn't allow access to the database. In these cases, being able to externally cache database results can greatly increase performance and allow you to scale to meet increasing workloads.

Being able to demonstrate hands-on knowledge of these technologies will be a real asset when it comes interview time as you're trying to get a cloud job.


Get the skills needed for a better career.

Master modern tech skills, get certified, and level up your career. Whether you’re starting out or a seasoned pro, you can learn by doing and advance your career in cloud with ACG.