Before running the project, make sure you have AWS CLI configured with your account access key ID and secret so that Terraform can access AWS resources.
-
Build Docker Images:
- Build the Dockerfiles for both the APP and Batch services.
- Use the following commands:
docker build -t flask-app:latest /app-python-code/. docker build -t batch-helloworld:latest ./app-infra-code/modules/batch/. - Building the Docker images with these specific names is crucial for the ECR module to function correctly. It ensures that Terraform can push the startup/initial Docker images to ECR, and subsequent resources like ECS Fargate tasks and Batch jobs can fetch them automatically after terraform apply is done.
-
Initialize Terraform:
- Run
terraform initin "./app-infra-code/" to initialize the Terraform configuration and modules.
- Run
-
Apply Terraform Changes:
- Run
terraform applyin "./app-infra-code/" to apply the Terraform configuration and create/update AWS resources as defined.
- Run