Back to feed
Dev.to
Dev.to
5/9/2026
How I Deployed FastAPI to EC2 with HTTPS Using API Gateway

How I Deployed FastAPI to EC2 with HTTPS Using API Gateway

Short summary

Deploy a FastAPI backend to AWS EC2 and secure it with HTTPS using API Gateway, which automatically provides SSL certificates without manual configuration. Key steps: set up EC2 with Docker, configure API Gateway as HTTP_PROXY, and ensure the integration URI includes {proxy} with parameter mapping to correctly route paths. Watch for two common gotchas: Docker Compose plugin installation requires manual binary download, and missing {proxy} in the URI will route all requests to root.

  • API Gateway automatically handles SSL—no manual certificate management needed
  • Integration URI must include {proxy} with parameter mapping for proper path routing
  • Docker Compose plugin requires manual binary installation on Ubuntu

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Explore more