This repo is mainly about a demo to deploy a tensorflow model on AWS ECS and use api to call the model.
- terraform
- tensorflow == 2.8.0
- python == 3.8
- fastapi
That's how the infra architect looks like after run terrafrom init
and terraform apply
on the infra
folder.
The step to build this infra:
- Create a
terraform.tfvars
file ininfra
folder and save your secret there - Set up the VPC (vpc, Internet Gateway, route table, subnet)
- Set up the ECS cluster, define the ECS task and set up the ECS service
- Set up IAM role for the ECS task to grant it permission to access S3 and ECR
- Set up the Application Load Balancer to load traffic to ECS service in different subnet
- Set up the security group of ALB and ECS, only allow input traffic from ALB to be in the ECS service
- Set up a log group for debug and monitor what's inside the ECS service