This guide provides step-by-step instructions to deploy the auction microservice application on Amazon EKS from scratch.
- AWS CLI v2.x installed and configured
- kubectl v1.28+
- Terraform v1.5+
- Docker Desktop
- Helm v3.x
- Git
- Administrator access or permissions for:
- EKS cluster creation
- VPC and networking resources
- IAM roles and policies
- EC2 instances
- Load balancers
The application consists of:
- 9 microservices (API Gateway, Auth, Bid, Listings, Payments, Profile, Email, Expiration, Saga Orchestrator)
- 5 MySQL database instances
- NATS Streaming for event communication
- Redis for caching
- React frontend
- NGINX Ingress Controller
git clone https://github.com/PramithaMJ/auction-microservice.git
cd auction-microserviceaws configure
# Enter your AWS Access Key ID, Secret Access Key, region, and output formatVerify configuration:
aws sts get-caller-identitycd infraterraform init# Edit variables.tf if needed
vim variables.tfDefault configuration:
- Region: us-east-2
- Cluster name: auction-site-cluster
- Kubernetes version: 1.33
- Instance type: t3.xlarge
- VPC CIDR: 10.0.0.0/16
terraform plan
terraform applyThis creates:
- VPC with public/private subnets
- EKS cluster
- Managed node group
- Security groups
- IAM roles and policies
aws eks update-kubeconfig --region us-east-2 --name auction-site-clusterVerify cluster access:
kubectl get nodeskubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.2/deploy/static/provider/aws/deploy.yamlWait for ingress controller to be ready:
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=90skubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yamlgit clone https://github.com/kubernetes/autoscaler.git
cd autoscaler/vertical-pod-autoscaler/
./hack/vpa-up.sh
cd ../../../kubectl apply -f k8s/namespaces.yaml# Copy example secrets file
cp k8s/secrets/auction-secrets.example.txt k8s/secrets/auction-secrets.txt
# Edit secrets with your values
vim k8s/secrets/auction-secrets.txtRequired secrets:
- Database passwords
- JWT secret
- Stripe API keys
- Email service credentials
Create secrets in cluster:
kubectl create secret generic auction-secrets \
--from-env-file=k8s/secrets/auction-secrets.txt \
-n auction-system# Storage classes and persistent volumes
kubectl apply -f k8s/infrastructure/storageclass.yaml
kubectl apply -f k8s/infrastructure/mysql-pvcs.yaml
# MySQL databases
kubectl apply -f k8s/infrastructure/auth-mysql.yaml
kubectl apply -f k8s/infrastructure/bid-mysql.yaml
kubectl apply -f k8s/infrastructure/listings-mysql.yaml
kubectl apply -f k8s/infrastructure/payments-mysql.yaml
kubectl apply -f k8s/infrastructure/profile-mysql.yaml
# Message broker and cache
kubectl apply -f k8s/infrastructure/nats-streaming.yaml
kubectl apply -f k8s/infrastructure/redis.yamlWait for databases to be ready:
kubectl wait --for=condition=ready pod -l app=auth-mysql -n auction-system --timeout=300s
kubectl wait --for=condition=ready pod -l app=bid-mysql -n auction-system --timeout=300s
kubectl wait --for=condition=ready pod -l app=listings-mysql -n auction-system --timeout=300s
kubectl wait --for=condition=ready pod -l app=payments-mysql -n auction-system --timeout=300s
kubectl wait --for=condition=ready pod -l app=profile-mysql -n auction-system --timeout=300skubectl apply -f k8s/configmaps/mysql-init-scripts.yaml# ConfigMaps
kubectl apply -f k8s/configmaps/auction-configmap.yaml
kubectl apply -f k8s/configmaps/frontend-configmap.yaml
# Microservices
kubectl apply -f k8s/deployments/auth.yaml
kubectl apply -f k8s/deployments/bid.yaml
kubectl apply -f k8s/deployments/listings.yaml
kubectl apply -f k8s/deployments/payments.yaml
kubectl apply -f k8s/deployments/profile.yaml
kubectl apply -f k8s/deployments/email.yaml
kubectl apply -f k8s/deployments/expiration.yaml
kubectl apply -f k8s/deployments/saga-orchestrator.yaml
kubectl apply -f k8s/deployments/api-gateway.yaml
kubectl apply -f k8s/deployments/frontend.yaml
# Services
kubectl apply -f k8s/services/microservices-services.yaml
kubectl apply -f k8s/services/api-gateway-service.yaml
kubectl apply -f k8s/services/frontend-service.yamlkubectl apply -f k8s/auto-scaling/hpa.yaml
kubectl apply -f k8s/auto-scaling/vpa.yamlkubectl get svc -n ingress-nginx ingress-nginx-controllerNote the EXTERNAL-IP value. Update the ingress configuration:
# Edit ingress file with your load balancer URL
vim k8s/ingress/auction-ingress.yamlReplace the host value with your load balancer URL.
kubectl apply -f k8s/ingress/auction-ingress.yamlkubectl get pods -n auction-systemAll pods should be in Running status.
kubectl get svc -n auction-systemkubectl get ingress -n auction-system# Get the load balancer URL
kubectl get ingress auction-ingress -n auction-systemAccess the application using the ADDRESS shown in the ingress output.
kubectl apply -f k8s/infrastructure/jaeger.yamlkubectl apply -f k8s/monitoring/datadog-agent.yamlkubectl logs <pod-name> -n auction-systemkubectl get events -n auction-system --sort-by='.lastTimestamp'kubectl describe svc <service-name> -n auction-systemkubectl logs -n ingress-nginx deployment/ingress-nginx-controllerTo destroy all resources:
# Delete Kubernetes resources
kubectl delete namespace auction-system
# Delete infrastructure
cd infra
terraform destroy