How sannidhisriram-06/self-healing-microservice works
This repository is a Spring Boot microservice and its AWS deployment infrastructure, designed for health-based routing and recovery. The main request path is client → ALB → EC2-hosted container → Spring controller; separate health checks inform traffic routing, container status, and instance replacement, while CPU metrics drive scaling. Terraform defines the cloud resources, and the launch configuration pulls and runs the image from Docker Hub. The workflow and deployment details are documented in the README; sampled Java source confirms the application entry point and root handler.
Main entry points: compute.tf EC2 instances · alb.tf Application load balancer · Dockerfile Service container · security.tf Security groups
Components 14
Application
- Spring Boot app
src/main/java/com/sriram/selfhealing/SelfhealingApplication.java - Root controller
src/main/java/com/sriram/selfhealing/HelloController.java - Actuator health
pom.xml
Container Runtime
- Container definition
Dockerfile - Docker Hub
- Service container
Dockerfile
AWS Infrastructure
- VPC and subnets
terraform/vpc.tf - Security groups
terraform/security.tf - Application load balancer
terraform/alb.tf - Target group
terraform/alb.tf - EC2 instances
terraform/compute.tf
Health and Recovery
- Auto Scaling Group
terraform/compute.tf - CPU scaling policy
terraform/compute.tf
Other components
- HTTP client
Connections 16
- HTTP client → Application load balancer: sends requests
- Application load balancer → Target group: forwards traffic
- Target group → EC2 instances: routes requests
- EC2 instances → Docker Hub: pulls image
- EC2 instances → Service container: runs container
- Service container → Spring Boot app: runs app
- Spring Boot app → Root controller: dispatches route
- Root controller → HTTP client: returns response
- Application load balancer → Actuator health: checks health
- Service container → Actuator health: polls health
- Auto Scaling Group → Target group: reads health
- Auto Scaling Group → EC2 instances: replaces instances
- Auto Scaling Group → CPU scaling policy: applies policy
- VPC and subnets → EC2 instances: hosts instances
- Security groups → Application load balancer: restricts access
- Security groups → EC2 instances: restricts access