Complete production-ready EKS infrastructure with three Spring Boot microservices, secured frontend, and CI/CD pipeline.
- Infrastructure: EKS cluster (3 nodes) on AWS
- Microservices: Calculator, Weather, Live Traffic (Spring Boot)
- Frontend: React-based GUI with authentication
- Deployment: Helm charts
- CI/CD: AWS CodePipeline + CodeBuild
- IaC: Terraform
- Container Registry: Amazon ECR
eks-microservices-project/
├── terraform/ # Infrastructure as Code
│ ├── modules/
│ │ ├── vpc/ # VPC network module
│ │ ├── eks/ # EKS cluster module
│ │ └── ecr/ # ECR repository module
│ ├── main.tf
│ ├── variables.tf
│ ├── outputs.tf
│ └── terraform.tfvars.example
├── microservices/ # Spring Boot applications
│ ├── calculator/
│ ├── weather/
│ └── live-traffic/
├── frontend/ # React frontend with auth
├── helm-charts/ # Helm deployments
│ ├── calculator/
│ ├── weather/
│ ├── live-traffic/
│ └── frontend/
├── kubernetes/ # K8s manifests
├── buildspec/ # AWS CodeBuild specs
├── scripts/ # Automation scripts
└── docs/ # Documentation
- AWS account with Free Tier or credits
- Install required tools:
# Install AWS CLI v2 curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install # Install Terraform wget https://releases.hashicorp.com/terraform/1.6.0/terraform_1.6.0_linux_amd64.zip unzip terraform_1.6.0_linux_amd64.zip sudo mv terraform /usr/local/bin/ # Install kubectl curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl # Install Helm curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash # Install eksctl (optional but useful) curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_Linux_amd64.tar.gz" tar -xzf eksctl_Linux_amd64.tar.gz -C /tmp && sudo mv /tmp/eksctl /usr/local/bin
cd eks-microservices-project
# Configure AWS CLI
aws configure
# Enter: Access Key ID, Secret Access Key, Region (us-east-1), Output (json)
# Set environment variables
export AWS_REGION="us-east-1"
export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
export PROJECT_NAME="eks-microservices-rajesh"cd terraform
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your details
terraform init
terraform plan
terraform apply -auto-approve
# Update kubeconfig for EKS
aws eks update-kubeconfig \
--region us-east-1 \
--name eks-microservices-cluster# Login to ECR
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
chmod +x scripts/build-push-all.sh
./scripts/build-push-all.shchmod +x scripts/deploy-all-helm.sh
./scripts/deploy-all-helm.sh
kubectl get pods -n microservices
kubectl get svc -n microserviceskubectl get svc frontend-service -n microservices
# Access at http://<EXTERNAL-IP>
# Default credentials: admin / admin123# Create repository
aws codecommit create-repository \
--repository-name eks-microservices-project \
--repository-description "EKS Microservices Platform"
# Add remote and push
git remote add codecommit https://git-codecommit.us-east-1.amazonaws.com/v1/repos/eks-microservices-project
git push codecommit maincd terraform
terraform destroy -auto-approvechmod +x scripts/destroy-all.sh
./scripts/destroy-all.sh- EKS Cluster: $0.10/hour (~$73/month) for control plane
- EC2 Nodes: t3.medium (3 nodes) ~$90/month
- ALB: ~$20/month
- ECR: Negligible for small images
- Estimated monthly cost: ~$183/month
- Use Spot Instances:
# Already configured in terraform/modules/eks/main.tf capacity_type = "SPOT"
- Scale down nodes when not in use:
aws eks update-nodegroup-config \ --cluster-name eks-microservices-cluster \ --nodegroup-name eks-node-group \ --scaling-config minSize=0,maxSize=3,desiredSize=0 - Delete when not in use:
terraform destroy -auto-approve
- Authentication: Username/password on frontend
- IAM Roles for Service Accounts (IRSA): Fine-grained pod permissions
- Network Policies: Restricted pod communication via Calico
- Security Groups: Controlled ingress/egress
- Secrets Management: AWS Secrets Manager + K8s secrets
- Private EKS: Optional private endpoint configuration
# CodeBuild logs
aws codebuild batch-get-builds --ids <build-id>
# Application logs
kubectl logs -f deployment/<service-name> -n microservices
# EKS cluster events
kubectl get events -n microservices --sort-by='.lastTimestamp'