/fastapi-fargate

Terraform code with FastAPI service for backend and host it to AWS FARGATE and FARGATE SPOT

Primary LanguageHCL

Custom badge Custom badge Custom badge Custom badge Custom badge

Introduction

  • Creatoin of FastAPI Service
  • Contanerize the application using Docker Client
  • Upload the Docker Image to Docker Hub
  • Create a Elastic Container Repository (ECR) with Terraform
  • Upload the Docker Inage to Elastic Container Repository (ECR) by cmd line
  • Create a Cluster with Terraform
  • Create Task defination in Cluster, assign resource type like CPU, Memory with Terraform
  • Create Service as Fargate and Fargate Spot
  • Create a Capacity provider strategy, if Fargate Spot is available use it primilarily and if failed then use Fargate with Terraform
  • Deploy ECR Image to ECS Cluster and run the task in the service we created earlier.
  • hence, the final Public IP will be the hosted service and ready to use it.