0% found this document useful (0 votes)
7 views8 pages

Project Rough Draft

The document outlines a project for transforming a legacy monolithic forum application into a scalable microservices architecture using AWS CloudFormation. It details the architecture design, which includes a Network Stack and a Microservices Stack, and emphasizes automation through CI/CD pipelines, Infrastructure as Code, and cost optimization strategies. The architecture supports independent scalability, resilience, and portability of services, leveraging various AWS services like ECS Fargate, RabbitMQ, and Redis.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views8 pages

Project Rough Draft

The document outlines a project for transforming a legacy monolithic forum application into a scalable microservices architecture using AWS CloudFormation. It details the architecture design, which includes a Network Stack and a Microservices Stack, and emphasizes automation through CI/CD pipelines, Infrastructure as Code, and cost optimization strategies. The architecture supports independent scalability, resilience, and portability of services, leveraging various AWS services like ECS Fargate, RabbitMQ, and Redis.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

R1 - Architecture Diagram (Updated)

Now that you've split your CloudFormation templates into:


1. Network Stack
o VPC

o Private subnets

o Application Load Balancer

2. Microservices Stack
o API Gateway Microservice

o Identity Microservice (JWT-based Auth)

o Post Microservice (event producer)

o Search Microservice (event consumer)

o RabbitMQ (Messaging)

🧾 Detailed Project Explanation


📌 Project Title:
Scalable Microservices Deployment with CI/CD using AWS
CloudFormation

🧭 Project Overview & Objectives


This project focuses on transforming a legacy monolithic forum application
into a cloud-native, scalable microservices-based architecture. The primary
goals are:
 Decouple services to allow independent scalability and deployments.
 Enable cost-efficient infrastructure using serverless containers (AWS Fargate).
 Automate deployment pipelines using AWS-native CI/CD services.
 Implement Infrastructure as Code (IaC) for repeatable, version-controlled
provisioning.

📐 Architecture Design Overview


The project is structured using two CloudFormation stacks:
1. Network Stack:
 VPC with private subnets for security.
 Application Load Balancer (ALB) to route incoming HTTP traffic.
 Outputs from this stack (subnet IDs, ALB Target Group ARNs) are passed into
the next stack.
2. Microservices Stack:
Deploys all backend components as ECS Fargate services:
 API Gateway Microservice: Serves as the public entry point.
 Identity Microservice: Handles user authentication and issues JWT tokens.
 Post Microservice: Handles post creation and publishes post.create events
to RabbitMQ.
 Search Microservice: Listens to RabbitMQ and indexes searchable content.
 RabbitMQ Microservice: Handles asynchronous communication.
 Redis Microservice: Caching and/or session management.
All services are containerized using Docker and stored in Amazon ECR,
ensuring portability and versioning.

🔁 Communication Flow
1. Client sends request → API Gateway routes to correct service (e.g., Post).
2. Identity Service issues JWT token after login.
3. Post Service receives valid request → publishes event to RabbitMQ.
4. Search Service listens and updates the search index accordingly.
5. Client can query Search Service to retrieve relevant posts.

🔄 CI/CD Pipeline
 Source Code Repositories: Hosted in CodeCommit or GitHub.
 Pipeline: Built using AWS CodePipeline and includes:
o Source (CodeCommit/GitHub)

o Build (CodeBuild for Docker image creation and pushing to ECR)

o Deploy (CloudFormation update or ECS Blue/Green deployment via


CodeDeploy)
This enables automated testing, building, and deployment of
microservices whenever code changes are pushed.

🧱 Infrastructure as Code (IaC)


 CloudFormation Templates:
o One for networking infrastructure.

o One for microservices and compute resources.

Benefits:
 Eliminates configuration drift
 Easy replication of environments (dev/staging/prod)
 Version-controlled deployments

📈 Scalability & Resilience


 Each service is deployed in ECS Fargate (serverless containers) which auto-
scales based on demand.
 ALB with multiple target groups directs traffic to appropriate services.
 RabbitMQ decouples services, making them resilient to load spikes and
failures.

💰 Cost Optimization
 Serverless (Fargate) and pay-as-you-go services reduce idle costs.
 Redis and RabbitMQ use low-tier instances (like t3.micro) where applicable.
 CloudFormation ensures repeatable, automated deployment without manual
errors.
Estimated Monthly Cost: ~$80–$130 depending on usage (detailed in R2).
📦 Tools & Technologies

Category Tool/Service

Compute AWS ECS (Fargate)

Networking ALB, VPC, Subnets

Messaging RabbitMQ (Amazon MQ)

Caching Redis (Amazon ElastiCache)

Auth JWT (via Identity Service)

CodePipeline, CodeBuild,
CI/CD
CodeDeploy

Container
Amazon ECR
Repo

IaC AWS CloudFormation

✅ R3 – Microservices-Based Architecture
The solution follows a domain-driven microservices design where each
service is self-contained, independently deployable, and owns its own data
and logic. Each microservice is containerized and deployed using AWS
Fargate for isolation and auto-scaling.
List of Microservices:
1. API Gateway Service – Handles all incoming requests and routes them to
backend services.
2. Identity Service – Responsible for authentication, user management, and
issuing JWT tokens.
3. Post Service – Manages post creation and event publishing to RabbitMQ.
4. Search Service – Consumes events from RabbitMQ and maintains a search
index.
5. RabbitMQ Service – Facilitates asynchronous communication between
services.
6. Redis Service – Provides fast, in-memory data storage for session
management or caching

Microservices with MongoDB Integration:


 Identity Service: Stores user credentials and JWT token metadata.
 Post Service: Stores all forum posts with metadata like author, timestamp,
content, etc.
 Search Service: Uses MongoDB's full-text search capabilities to index and
query posts.

Each service communicates over HTTP or via message queues (RabbitMQ)


depending on its purpose, following microservice best practices like:
 Loose coupling
 Independent deployment
 Domain isolation
 Asynchronous processing

🔄 R4 – Portability
 All microservices are containerized using Docker and stored in Amazon
ECR, ensuring consistent execution across environments.
 Stateless architecture and use of managed services (ECS, Redis,
RabbitMQ, etc.) ensure that services aren’t tied to any specific EC2 instance
or hardware.
 The use of MongoDB Atlas ensures data is cloud-agnostic and not tied to AWS
infrastructure.
 All services connect to MongoDB using connection strings secured via Secrets
Manager.
 The database can be replicated or migrated to any cloud environment
supported by MongoDB (AWS, Azure, GCP).

 Infrastructure is fully defined via CloudFormation, making it easy to


redeploy or migrate to another AWS region or environment.
 CI/CD pipeline can deploy to any compatible environment (dev, staging, prod)
using environment-specific variables.
✅ This ensures the application code and infrastructure are completely
portable.

🚀 R5 – Scalability & Resilience


The system is designed to scale both horizontally and independently:
 ECS Fargate with Auto Scaling: Each microservice scales based on CPU or
memory usage.
 ALB with Multiple Target Groups: Traffic is routed intelligently to the
appropriate microservice.
 RabbitMQ Decoupling: Ensures the Post and Search services are loosely
connected, allowing the Search service to scale or recover independently.
 Stateless Services: Help distribute load evenly and handle failures
gracefully.
 Redis Caching: Improves response time and reduces load on backend
services.
The system can dynamically scale based on real-time usage patterns,
avoiding bottlenecks.
 MongoDB Atlas auto-scales storage and IOPS based on workload
demands.
 Built-in replica sets and failover mechanisms ensure data resilience
and availability.
 When ECS services scale out, each task can open its own connection pool
to MongoDB without risk of contention.

⚙️R6 – Automated CI/CD


A complete CI/CD pipeline is implemented using AWS-native tools:
✅ CodePipeline Stages:
1. Source: Triggers on code commit (GitHub or CodeCommit).
2. Build: Docker images are built using AWS CodeBuild and pushed to
Amazon ECR.
3. Test (Optional): Integration or unit tests can run here.
4. Deploy: Images are deployed to ECS using a blue/green deployment
strategy via CodeDeploy.
🔁 Blue/Green Deployment Benefits:
 No downtime during deployment.
 Rollbacks are easier and safer.
 Allows testing in production-like environment before switching live traffic.
✅ The pipeline automates the build, test, and deployment processes,
providing continuous delivery of updates.

🧰 R7 – Infrastructure as Code
The entire infrastructure is provisioned and managed using AWS
CloudFormation. It is split into:
🔹 Network Stack Template:
 VPC
 Subnets (private)
 Security Groups
 Application Load Balancer
🔹 Microservices Stack Template:
 ECS Cluster & Services
 Task Definitions for each service
 IAM Roles
 Target Groups and Listeners
 RabbitMQ (via Amazon MQ)
 Redis (via ElastiCache)
 Mongodb
Benefits of IaC:
 Reproducible environments
 Version-controlled infrastructure
 Quick recovery and scaling
 Eliminates configuration drift
✅ Changes to the infrastructure can be tracked, reviewed, and rolled back just
like code.

✅ Summary Table

Requireme
Fulfilled by
nt

Microservice architecture on ECS Fargate with


R3
containerized components

Dockerized services, CloudFormation, and AWS-native


R4
services for portability

Auto-scaling Fargate tasks, ALB, Redis, RabbitMQ for


R5
scalability & resilience

AWS CodePipeline with CodeBuild, ECR, and Blue/Green


R6
ECS Deployments

CloudFormation templates for complete infrastructure


R7
provisioning

You might also like