End-to-End E-Commerce Microservices Reference Architecture
Overview
This project represents a Enterprise-Grade Cloud Native Architecture. It demonstrates a complete E-Commerce platform deployed on AWS EKS, with full Automation, Testing, and Observability.
Key Features
- Infrastructure: 30+ AWS Resources (EKS, RDS, WAF, etc.) via Terraform.
- Application: Spring Boot Microservices with Redis Caching, RabbitMQ, and OpenTelemetry.
- DevOps: CI/CD via Jenkins & GitHub Actions (Self-Hosted), GitOps via ArgoCD.
- Quality Assurance: Selenium Grid (Cross-Browser) + SauceLabs Integration, Cucumber (BDD), RestAssured (API), JMeter (Performance).
- Observability: Prometheus, Grafana, ELK Stack, Jaeger.
1. Architecture
graph TD
User -->|HTTPS| CloudFront[CloudFront CDN]
CloudFront -->|WAF| APIGW[API Gateway]
APIGW -->|VPC Link| NLB[Network Load Balancer]
NLB -->|Traffic| Ingress[Ingress Controller]
subgraph "EKS Cluster (VPC Private Subnets)"
Ingress --> OrderSvc[Order Service]
Ingress --> ProductSvc[Product Service]
OrderSvc -->|Async Event| RabbitMQ[RabbitMQ / Amazon MQ]
RabbitMQ --> InventorySvc[Inventory Service]
OrderSvc -->|Read/Write| RDS[RDS PostgreSQL]
ProductSvc -->|Cache| Redis[ElastiCache Redis]
end
subgraph "Observability"
Prometheus -->|Scrape| OrderSvc
Filebeat -->|Ship Logs| ElasticSearch[OpenSearch]
Grafana -->|Query| Prometheus
end
subgraph "CI/CD & Testing"
Jenkins -->|Build| ECR[Amazon ECR]
SeleniumGrid -->|Test UI| CloudFront
SauceLabs -->|Cloud Test| CloudFront
end
2. Project Structure
| Directory | Description |
|---|---|
infra/ |
Terraform code for AWS (VPC, EKS, RDS, WAF, etc.). |
app/ |
Spring Boot with OTel Agent (Dockerfile). |
testing/ |
Automation: DriverFactory (SauceLabs), Cucumber (.feature). |
cicd/ |
Pipelines: Jenkinsfile, GHA, ArgoCD (application.yaml). |
observability/ |
Monitoring: servicemonitor.yaml, Prometheus Values. |
3. Detailed Implementation Steps
Step 1: Provision Infrastructure (Terraform)
- Navigate to
infra/. - Run
terraform initto download providers. - Run
terraform apply. This creates:- VPC: Private subnets for EKS/RDS.
- EKS: Control Plane and Fargate Profiles.
- Databases: RDS and OpenSearch.
- Output: Note the
cluster_endpointandnlb_dns_name.
Step 2: Configure EKS & Observability
- Update local kubeconfig:
aws eks update-kubeconfig --name ecommerce-prod-cluster. - Install Prometheus Operator:
bash helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm install prometheus prometheus-community/kube-prometheus-stack -f observability/prometheus-values.yaml- Scraping Logic: We use a
ServiceMonitor(seeinfra/k8s/servicemonitor.yaml). This CRD tells Prometheus "Find any Service with labelapp: ecommerce-serviceand scrape port8080path/actuator/prometheus".
- Scraping Logic: We use a
- Install Log Shipping:
bash kubectl apply -f observability/filebeat-kubernetes.yaml- This DaemonSet reads
/var/log/containers/*.logand sends them to the OpenSearch domain created by Terraform.
- This DaemonSet reads
Step 3: Application Telemetry (OpenTelemetry)
We use the OpenTelemetry Java Agent for zero-code instrumentation.
1. Where: In app/Dockerfile, we download opentelemetry-javaagent.jar.
2. How: The app starts with -javaagent:/app/opentelemetry-javaagent.jar.
3. Config: Environment variables in Kubernetes Deployment (OTEL_TRACES_EXPORTER=otlp) point to the Jaeger/Tempo collector.
4. Result: Every API call generates a Trace ID that propagates through API GW -> Order Service -> RabbitMQ -> Inventory.
Step 4: Testing & Automation
- API Testing:
- The API is exposed via AWS API Gateway.
- Get the Endpoint:
terraform output api_endpoint. - Run Tests:
mvn test -DbaseURI=<API_ENDPOINT>.
- Cross-Browser Testing (SauceLabs):
- We use
DriverFactory.java. - Set Env Vars:
export SAUCE_USERNAME=user SAUCE_ACCESS_KEY=key. - Run:
mvn test -Dplatform=saucelabs. - The tests connect to the SauceLabs Cloud Grid instead of local Docker.
- We use
Step 5: CI/CD (GitOps)
- Push Code: Commit changes to Git.
- Jenkins/GHA: Builds Docker image -> Pushes to ECR -> Updates Helm Chart version in Git.
- ArgoCD: Detects the change in Git and syncs the EKS cluster to the new version automatically.