Intro
I wanted to deploy my FastAPI backend on AWS EC2 and get a proper HTTPS URL without dealing with SSL certificates manually. Turns out API Gateway handles all of that for you — but getting there wasn't as smooth as I expected. Here's everything I went through, including the parts where I got stuck.
EC2 instance setup is covered in my previous post, so I'll skip that part here!
Overview
FastAPI App ↓ Dockerize & deploy on EC2 ↓ Connect API Gateway ↓ HTTPS URL ready to go
Enter fullscreen mode
Exit fullscreen mode
Step 1. Elastic IP
The Elastic IP was provided by our organization, so I just attached it to the instance.
Without an Elastic IP, your EC2 public IP changes every time you restart the instance — which means you'd have to update your API Gateway integration every single time.
Step 2.…