Scalable FastAPI Applications on AWS

  • Updated November 7th, 2023
  • v2.0.0
Jan Giacomelli Jan Giacomelli

Build scalable applications with FastAPI and Terraform that run on AWS!


In this course, you will learn how to build scalable FastAPI applications that run on AWS. By the end of the course, you will be able to do things like:

  • Structure a Git repository
  • Perform code reviews
  • Document your API
  • Manage infrastructure with code using Terraform
  • Manage multiple configurations and environments
  • Deploy and monitor your application
  • Configure and manage a CI/CD pipeline
  • Manage a database and migrations
  • Build, publish, and use private Python packages
  • Develop an application with small, test-driven iterations
  • Use feature flags
  • Continuously deploy to production

These things are crucial when you want to develop at rapid pace. You'll learn how to go from idea to scalable FastAPI application running on AWS infrastructure managed by Terraform. You'll learn how to use all modern tools in approaches to minimize your work while maximizing the output for your FastAPI applications.

What will you learn?

Select a Part

In this first part, you'll learn how to structure your Git repository and application skeleton for developing scalable FastAPI applications. The remainder of this part will focus on configuring a CI/CD pipeline on GitLab CI for running tests and deploying your application to AWS ECS. You'll manage AWS infrastructure using Terraform, an Infrastructure as Code tool.

Learning Objectives

  1. Develop an API with FastAPI
  2. Configure CI/CD pipeline jobs for running tests and checking code quality checks, managing AWS infrastructure with Terraform, building and pushing Docker images to AWS ECR, and deploying applications to AWS ECS
  3. Set up a domain name and secure your app with SSL using AWS Route 53 and AWS Certificate Manager, respectively

In part 2, with the CI/CD pipeline configured and your application set up, you'll continue building our your application and setting up AWS infrastructure with Terraform as you make your way to continuous deployment. You'll leverage various GitLab services as you build and publish an internal Python package and set up feature flags via Unleash.

Learning Objectives

  1. Set up a Postgres database on AWS RDS using Terraform
  2. Manage database migrations inside your CI/CD pipeline
  3. Add end-to-end-tests and configure a CI/CD pipeline job for them
  4. Build, publish, and use internal Python packages on GitLab
  5. Use feature flags to slowly roll out new feature to users
  6. Monitor your application with AWS CloudWatch
  7. Set up continuous delivery

What do you need to know?

This course is targeted at advanced-beginners -- someone with at least 6 months of web development experience. Before beginning, you should have some familiarity with the following topics:

Meet the Author

Jan Giacomelli

Jan Giacomelli

Jan is a software engineer who lives in Ljubljana, Slovenia, Europe. He is a Staff Software Engineer at ren.co where he is leading backend engineering efforts. He loves Python, FastAPI, and Test-Driven Development. When he's not writing code, deploying to AWS, or speaking at a conference, he's probably skiing, windsurfing, or playing guitar. Currently, he's working on his new course Complete Python Testing Guide.

What developers are saying

The TestDriven.io courses are some of the best courses I've ever done for any language, any platform, any price range... just some of the most thorough and well-sourced courses around.

Just a word of thanks for doing such a great job with these training courses. The thorough, entire-lifecycle approach -- from implementation through test, coverage, quality, CI/CD, and all the rest -- is what separates these courses from other training material that I've completed. I'll be able to walk away from here with knowledge and skills that I can apply immediately at work -- and for that I'm grateful. It's a rare gift in an environment where so much 'training' is really just lightweight treatment that doesn't begin to scratch the surface of real, end-to-end software development. Really well done!

The TestDriven.io courses are worth 10 times what I paid for them.

I'm writing to thank you for all the tutorials and the work you've put out there. I'm new to DevOps and I found TestDriven.io while looking for Django and DevOps related topics. One of the best collections of tutorials and guides I've seen -- very well-written, clear, and concise. You have saved me so much time and energy. Thanks from the bottom of my heart.

I am very much into buying and purchasing any course by you and your team. I've never felt like a better programmer ready to show my coding chops to the world.

Frequently Asked Questions

What tools and technologies are used in this course?

This course covers a variety of technologies and services:

Core

  1. Python
  2. FastAPI
  3. Terraform
  4. GitLab
  5. Poetry
  6. Docker
  7. pydantic
  8. SQLAlchemy
  9. Alembic
  10. Uvicorn

AWS

  1. VPC
  2. Route 53
  3. Certificate Manager
  4. ECS
  5. ECR
  6. RDS
  7. Auto Scaling
  8. Elastic Load Balancing
  9. IAM

Testing

  1. pytest
  2. pytest-cov
  3. pytest-env
  4. Coverage.py

Code Quality

  1. Flake8
  2. Black
  3. isort
  4. Bandit
  5. Safety

Monitoring

  1. AWS CloudWatch
  2. Sentry

Continuous Deployment

  1. GitLab
  2. Unleash

What can I learn to do with FastAPI and AWS?

FastAPI is a high-performance, easy-to-learn, fast-to-code, ready-for-production Python web framework. AWS is the most popular cloud service provider. Together they're a powerful combination for building everything from simple proof of concepts to large, scale enterprise applications. This includes:

  • exposing ML models via a RESTful API
  • web applications for scheduling for a hairdresser
  • fleet management systems

With FastAPI and AWS, you can build almost any application you can imagine.

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.