This project deploys a Node.js application alongside a MongoDB database using AWS ECS with Fargate. The architecture leverages the AWS Cloud ecosystem for a scalable and robust deployment.
The architecture is designed for high availability and scalability, including:
- Amazon ECS (Elastic Container Service): Runs Docker containers managed by Fargate, which abstracts the server management.
- Application Load Balancer (ALB): Distributes incoming application traffic across multiple containers.
- Amazon CloudWatch: Monitors the application and logs the events for troubleshooting and analytics.
- VPC & Public Subnet: Ensures network security and connectivity to the Internet.
- AWS ECR (Elastic Container Registry): Stores the Docker images used by ECS.
server.js
: The main Node.js server file that serves the application logic.Dockerfile
: Instructions for Docker to build the Node.js application image.docker-compose.yml
: Defines the multi-container setup for local testing.ecs-task-definition.json
: The task definition file for AWS ECS deployment.
- so if you run locally you could see the webpage at
localhost:3000
- To add the data you should visit
localhost:3000/add
(Please refer to server.js for all other api's) - If the application is hosted on the ECS the DNS address of load balancer is enough to access the main page
- //y to add the data
DNSaddress/add
should take you to the page to that let's you add the data.
- Push the Node.js application Docker image to ECR.
- Create an ECS cluster and configure the VPC and subnets.
- Define an ECS task using the task definition JSON.
- Run the task or service with the Application Load Balancer.
- Monitor the application using Amazon CloudWatch.
To run the application locally, ensure Docker is installed and use:
docker-compose up --build
Contributions are welcome. Please fork the repository and submit a pull request.