Terraform and Flask

In this tutorial, we'll learn how to deploy a Python Flask application that queries a Redis database hosted by AWS ElastiCache.

Instead of manually configuring Redis on ElastiCache, we'll use Terraform with Release's infrastructure runners to provision a Redis cluster.

We'll start with the awesome-release/release-terraform-flask-redis application.

Step 1: Fork the GitHub repo

Fork awesome-release/release-terraform-flask-redis on GitHub using the account you have authenticated with Release.

Step 2: Create a new Release application

  1. Enter a unique name for your application.

  2. Select the fork you created in step 1.

  3. Click Next Step.

  1. Select the main branch.

  2. Select compose.yaml.

  3. Click Start Analysis.

  1. Click Next Step.

  1. Select the main branch.

  2. Select .release/application_template.yaml.

  3. Make sure the application's context and domain are correct.

  4. Click Next Step.

  1. Select .release/environment_variables.yaml.

  2. Click Next Step.

  1. Click Deploy your app!

Step 3: Follow the deployment

Release will build and deploy your application. Open the infrastructure runner step to see output from Terraform.

Step 4: View the environment

View the environment detail page and click on the web URL.

Result

You should see HTML output showing the number of times this application has been viewed.

If the resulting view count is more than you anticipated, keep in mind that Release's health checker makes an HTTP request, which counts as a page view in our example.

Further reading

Last updated