EKS Production Deployment
Complete guide to deploying mcp-server-langgraph on AWS EKS with production-grade infrastructure, security, and observability.
Overview
This deployment achieves 96/100 infrastructure maturity with:
Infrastructure as Code Terraform modules for VPC, EKS, RDS, ElastiCache
High Availability Multi-AZ across all services with automatic failover
Security First IRSA, encryption everywhere, network isolation
Cost Optimized ~$803/month (60% savings vs. defaults)
What You’ll Deploy
Prerequisites
AWS Account Setup
AWS account with admin access
AWS CLI installed and configured (aws configure)
Account limits: 5 VPCs, 20 EIPs, 100 security groups per region
Deployment Architecture
Infrastructure Layers
Layer 1: Networking
Layer 2: Compute
Layer 3: Data
Layer 4: Security
VPC Module (terraform/modules/vpc)
3 Availability Zones (us-east-1a/b/c)
Public subnets (/20) for load balancers
Private subnets (/18) for workloads
NAT Gateways (multi-AZ)
VPC Endpoints (S3, ECR, CloudWatch)
VPC Flow Logs
Capacity : 16,384 IPs per private subnet (~300 EKS nodes per AZ)EKS Module (terraform/modules/eks)Control Plane :
Kubernetes 1.28
Multi-AZ (AWS managed)
All 5 log types enabled
KMS encryption for secrets
Node Groups :
General : t3.xlarge, 2-10 nodes, on-demand
Compute : c6i.4xlarge, 0-20 nodes, on-demand
Spot : mixed types, 0-10 nodes, 70-90% savings
Addons :
VPC CNI with IRSA
CoreDNS
kube-proxy
EBS CSI Driver
RDS Module (terraform/modules/rds)
PostgreSQL 15.4
db.t3.medium Multi-AZ
100 GB gp3 storage (auto-scaling to 1 TB)
30-day backup retention
Performance Insights
CloudWatch alarms
ElastiCache Module (terraform/modules/elasticache)
Redis 7.0
cache.r6g.large nodes
Standard mode (2 nodes) or Cluster mode (9 nodes)
Multi-AZ with automatic failover
7-day snapshot retention
IAM & Encryption :
IRSA for pod-to-AWS authentication
KMS encryption for secrets, RDS, ElastiCache
No long-lived IAM keys in pods
IAM roles with least-privilege policies
Network Security :
Private subnets only (no public IPs on pods)
Security groups with minimal ingress
VPC endpoints for AWS API calls
Network policies for pod-to-pod traffic
Step-by-Step Deployment
Initialize backend
Edit variables.tf or create terraform.tfvars:
Deploy backend
Creates :
S3 bucket: mcp-langgraph-terraform-state-prod
DynamoDB table: mcp-langgraph-terraform-lock-prod
Access logging bucket
Note outputs
Save the S3 bucket name and DynamoDB table name for next phase.
Phase 2: Infrastructure Deployment (20-25 minutes)
Plan deployment
Review :
~50 resources will be created
VPC, subnets, NAT gateways
EKS cluster and node groups
RDS instance
ElastiCache cluster
IAM roles and policies
Deploy infrastructure
Duration : 20-25 minutes
VPC: ~2 minutes
EKS control plane: ~10 minutes
Node groups: ~8 minutes
RDS Multi-AZ: ~12 minutes (parallel with EKS)
ElastiCache: ~5 minutes (parallel with EKS)
Phase 3: Kubernetes Configuration (10 minutes)
Create service account with IRSA
Phase 4: Deploy Application (5 minutes)
Build and push container image
Verify database connection
Phase 5: Monitoring & Auto-scaling (10 minutes)
Deploy Cluster Autoscaler
Configure CloudWatch Container Insights
Production Checklist
IRSA configured for all service accounts (no IAM keys)
Secrets stored in AWS Secrets Manager (not in code)
Network policies applied for pod-to-pod traffic
Pod Security Standards enforced (restricted)
RDS and ElastiCache in private subnets only
Encryption enabled for all data at rest (KMS)
TLS enforced for all in-transit data
Security groups follow least-privilege principle
CloudTrail enabled for audit logging
MFA required for AWS console access
Multi-AZ deployment for all services
RDS Multi-AZ with automatic failover
ElastiCache Multi-AZ with automatic failover
At least 2 replicas for application pods
Pod Disruption Budgets configured
Topology spread constraints configured
Health checks configured (liveness/readiness probes)
Load balancer health checks configured
Monitoring & Observability
CloudWatch Container Insights enabled
CloudWatch alarms for RDS (CPU, memory, storage, connections)
CloudWatch alarms for ElastiCache (CPU, memory, evictions)
CloudWatch alarms for EKS (node health, pod restarts)
X-Ray tracing configured for distributed tracing
Application logs shipped to CloudWatch Logs
Metrics Server deployed for HPA
Cluster Autoscaler deployed and configured
Backup & Disaster Recovery
RDS automated backups enabled (30-day retention)
RDS final snapshot on deletion enabled
ElastiCache automated snapshots enabled (7-day retention)
Terraform state versioning enabled in S3
Terraform state encrypted with KMS
Disaster recovery runbook documented
Backup restore procedures tested
Spot instances configured for fault-tolerant workloads
Cluster Autoscaler removing idle nodes
HPA scaling pods based on utilization
VPC endpoints configured (save 70% on data transfer)
RDS storage auto-scaling enabled
CloudWatch Logs retention configured (not infinite)
Cost allocation tags applied to all resources
AWS Cost Explorer monitoring enabled
Post-Deployment Operations
Accessing the Cluster
Viewing Logs
Scaling
Updating
Troubleshooting
See EKS Runbooks for detailed troubleshooting procedures.
Common issues :
Pods pending with 'Insufficient CPU'
Cause : Not enough node capacitySolution : Cluster Autoscaler will add nodes automatically. Check:
Can't pull images from ECR
Cause : Missing VPC CNI IRSA permissionsSolution :
Can't access Secrets Manager
Cause : Missing IRSA role or incorrect ARNSolution :
Cost Estimate
Production deployment (~$803/month) :
Cost Savings : Enable spot instances, use single NAT gateway in dev/staging, right-size node types, enable Cluster Autoscaler.
Terraform AWS Complete Terraform module documentation
EKS Runbooks Operational runbooks and troubleshooting
AWS Security Hardening Security configuration and best practices
Cost Optimization AWS cost optimization strategies
Next Steps
Deploy Production
Follow this guide to deploy your production environment
Configure Monitoring
Set up CloudWatch dashboards and alarms
Enable Auto-scaling
Configure Cluster Autoscaler and HPA
Harden Security
Follow AWS Security Hardening guide
Set Up CI/CD
Configure GitHub Actions for automated deployments