Skip to main content

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

1

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
2

Local Tools

3

Repository


Deployment Architecture

Infrastructure Layers

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)

Step-by-Step Deployment

Phase 1: Terraform Backend (5 minutes)

1

Initialize backend

Edit variables.tf or create terraform.tfvars:
2

Deploy backend

Creates:
  • S3 bucket: mcp-langgraph-terraform-state-prod
  • DynamoDB table: mcp-langgraph-terraform-lock-prod
  • Access logging bucket
3

Note outputs

Save the S3 bucket name and DynamoDB table name for next phase.

Phase 2: Infrastructure Deployment (20-25 minutes)

1

Configure environment

Create terraform.tfvars:
2

Initialize Terraform

3

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
4

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)
5

Save outputs

Phase 3: Kubernetes Configuration (10 minutes)

1

Configure kubectl

2

Create namespace

3

Create service account with IRSA

4

Create database secrets

5

Create Redis secrets

Phase 4: Deploy Application (5 minutes)

1

Build and push container image

2

Deploy using Kustomize

Or manually:
3

Verify deployment

4

Verify database connection

Phase 5: Monitoring & Auto-scaling (10 minutes)

1

Deploy Cluster Autoscaler

2

Deploy Metrics Server

3

Configure HPA

4

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
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
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
RTO/RPO targets defined
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:
Cause: Not enough node capacitySolution: Cluster Autoscaler will add nodes automatically. Check:
Cause: Missing VPC CNI IRSA permissionsSolution:
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

1

Deploy Production

Follow this guide to deploy your production environment
2

Configure Monitoring

Set up CloudWatch dashboards and alarms
3

Enable Auto-scaling

Configure Cluster Autoscaler and HPA
4

Harden Security

Follow AWS Security Hardening guide
5

Set Up CI/CD

Configure GitHub Actions for automated deployments