This guide provides instructions on how to deploy the Sentiment-Driven Algorithmic Paper Trader to AWS.
- AWS Account
- AWS CLI installed and configured
- Docker installed locally
- Install the EB CLI:
pip install awsebcli
- Initialize EB in the root folder:
eb init -p docker
- Create an environment and deploy:
eb create sentiment-trader-env eb deploy
-
Push Images to ECR (Elastic Container Registry):
- Create two repositories in ECR:
sentiment-backendandsentiment-frontend. - Build and push your images to these repos:
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin <aws_account_id>.dkr.ecr.us-east-1.amazonaws.com docker build -t sentiment-backend ./backend docker tag sentiment-backend:latest <aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/sentiment-backend:latest docker push <aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/sentiment-backend:latest docker build -t sentiment-frontend ./frontend docker tag sentiment-frontend:latest <aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/sentiment-frontend:latest docker push <aws_account_id>.dkr.ecr.us-east-1.amazonaws.com/sentiment-frontend:latest
- Create two repositories in ECR:
-
Create an ECS Cluster:
- Go to the ECS Console and create a new cluster using AWS Fargate.
-
Create Task Definitions:
- Create a task definition for the backend using the
sentiment-backendimage (expose port 8000). - Create a task definition for the frontend using the
sentiment-frontendimage (expose port 3000). SetNEXT_PUBLIC_API_URLto the backend service's URL.
- Create a task definition for the backend using the
-
Create Services:
- Run the task definitions as Services within your ECS Cluster.
- Use an Application Load Balancer (ALB) for the frontend if you want to expose it publicly over port 80/443.
- Launch an EC2 Instance (e.g., Ubuntu t3.medium).
- SSH into the instance and install Docker & Docker Compose.
- Clone this repository to the instance.
- Run:
docker-compose up -d --build