Deploying a Flask and React Microservice to AWS ECS

  • Updated November 25th, 2020
  • v1.3.0
Michael Herman Michael Herman

Learn how to deploy microservices to Amazon ECS powered by Flask, React, and Docker!


In this course, you'll learn how to use AWS CodeBuild for continuous integration and delivery along with AWS Elastic Container Service (ECS) for container orchestration in order to deploy a set of microservices powered by Python, Flask, and React.

Various logos sitting around an Octopus

What will you learn?

Select a Part

In part 1, you'll learn how to manage Docker-based microservices on AWS via Elastic Container Service (ECS). You'll also wire up CodeBuild for building and testing Docker images along with Elastic Container Registry (ECR) for storing Docker images.

Learning Objectives

  1. Explain what container orchestration is and why you may need to use an orchestration tool to manage deployments
  2. Discuss the pros and cons of using Elastic Container Service (ECS) over other orchestration tools like Kubernetes, Mesos, and Docker Swarm
  3. Set up an IAM user
  4. Create a production Dockerfile that uses multistage Docker builds
  5. Utilize Amazon Elastic Container Registry (ECR) image registry to store built images
  6. Configure CodeBuild to run when code is checked in to GitHub
  7. Run unit and integrations tests and check code for quality and formatting issues on CodeBuild

In part 2, we'll set up Amazon Relational Database Service (RDS), configure Elastic Container Service (ECS), and use Terraform to manage a Fargate cluster on ECS.

Learning Objectives

  1. Configure RDS for data persistence
  2. Configure an Application Load Balancer (ALB) along with ECS to run a set of microservices
  3. Send container logs to CloudWatch
  4. Update a running container via a zero-downtime deployment strategy to not disrupt the current users or your application
  5. Explain the types of scaling that are available to you within ECS
  6. Use AWS Fargate with ECS to deploy a microservice
  7. Spin up AWS infrastructure via Terraform

What do you need to know?

This is not a beginner course. It's designed for the advanced-beginner -- someone with at least six months of web development experience. Before beginning, you should have some familiarity with the following topics. Refer to these resources for more info:

Meet the Author

Michael Herman

Michael Herman

Michael is a software engineer and educator who lives and works in the Denver/Boulder area. He is the co-founder/author of Real Python. Besides development, he enjoys building financial models, tech writing, content marketing, and teaching.

What developers are saying

The Microservices with Docker, Flask, and React course bundle is the best course I've ever purchased! It teaches you how to design and build a microservices web application that can be deployed as a real production app. What really makes Michael's teaching unique is that after the basic guidelines, he pushes you to read and explore each tool, technology, and framework used in the course -- thus making you a better software engineer!

As a practicing anesthesiologist and a computer geek from way back, I've had a number of projects (without confidential data, of course) that I've been trying to get off the ground. But I kept going around in circles with Docker, Flask, and React. Michael's book is well written, clear and has given me a great base of knowledge and best practice in regards to really getting my projects done. Best of all, it's given me the confidence to just get on and get coding. Thanks!!

Great resource! If you want to get practical knowledge about microservices, implementing Flask and React and Dockerizing it -- I'm sure you will be satisfied.

Michael's course will not only help you to finally understand microservices, it will also provide you with a highly practical and useful sample application along with a very well structured eBook. Before taking this course I struggled to get a robust backend up and running. I didn't know whether I should go with a monolith or microservices architecture. This course not only gave me the necessary insights to make this decision it also helped me to code a production grade web application. It was fairly easy to build my own application with this course and use Michael's structure as a blueprint. In the end I was also able to brush up on Docker and learn how to containerize Flask microservices.

I've completed the Test-Driven Development with Python, Flask, and Docker and Deploying a Flask and React Microservice to AWS ECS courses. They both were a hugely valuable learning experience. As a self-taught programmer, having a professional explain in detail modern approaches to application architecture and deployment was incredibly valuable and has saved me countless hours of YouTube rabbit-holes.

Frequently Asked Questions

What tools and technologies are used in this course?

This course covers a variety of technologies and services:

Back-end

  1. Python
  2. Flask
  3. Postgres
  4. pytest
  5. Flask-RESTX
  6. Flask-SQLAlchemy
  7. Flask-CORS
  8. Flask-Bcrypt
  9. PyJWT
  10. Gunicorn
  11. Coverage.py
  12. flake8
  13. Black
  14. isort
  15. Swagger/OpenAPI

Front-end

  1. JavaScript
  2. Node
  3. React
  4. Formik
  5. Jest
  6. React Testing Library
  7. Axios
  8. React Router
  9. ESLint
  10. Prettier
  11. Formik
  12. Yup

Tools

  1. Create React App
  2. Docker
  3. Nginx
  4. HTTPie
  5. Terraform

AWS Services

  1. IAM
  2. Elastic Container Registry (ECR)
  3. CodeBuild
  4. CloudWatch
  5. Elastic Container Service (ECS)
  6. Elastic Load Balancing (ELB)
  7. RDS
  8. Fargate

What support does TestDriven.io offer?

Since the courses mimic real-world development, support is provided via Stack Overflow. Helpful users, including the developers of the courses, read and respond to messages on Stack Overflow. If you get stuck and you can't find an answer via Stack Overflow, feel free to reach out via email directly. Just be sure to detail what you've tried. For more, review Support and Consulting.

How long does it take to complete the course?

It's dependent on your current skill level. On average, it takes approximately 12 hours to complete.