Zero-Downtime Migration to Next.js and EKS: Lessons Learned
Real-world engineering insights from CyberAgent on migrating a legacy application to Next.js on AWS EKS and CloudFront without downtime.
Curated by Vibe DevOps · approx. 536 words
Key Takeaways
- CyberAgent engineers share their migration journey from Node 14 to Next.js on AWS EKS.
- An automated differential testing tool validated live responses between both systems to catch behavioral regressions prior to cutover.
- Traffic routing via CloudFront Functions and KeyValueStore (KVS) enabled instant rollbacks in the event of an incident.
- Pre-cutover load testing identified CPU throttling early, allowing the team to right-size pod resources and fine-tune autoscaling thresholds.
From Original Source
Validation Strategy and Differential Testing
When migrating from a legacy Node 14 application to Next.js on EKS, the engineering team kept all external contracts intact, including URL paths, HTTP status codes, and SEO metadata. Rather than relying solely on manual code reviews, they built an automated diffing tool to compare live responses between the legacy and new environments, detecting subtle variances in response headers and error pages.
Any intentional discrepancies were cataloged beforehand in a test manifest. Differential reports ensured that the new system only exhibited approved behavioral changes, eliminating latent regression risks prior to cutover.
From Original Source
Zero-Downtime Cutover and Infrastructure Optimization
The architecture leveraged a single CloudFront distribution routing traffic to both the legacy application and the new EKS cluster. A CloudFront Function reading from CloudFront KeyValueStore (KVS) dynamically routed requests, enabling instant traffic shifting without DNS propagation delays. Initial cache TTLs were set to 60 seconds to support rapid rollbacks if necessary.
Prior to the DNS cutover, the team executed simulated load tests and discovered that an initial 500m CPU limit caused throttling and cascading pod restarts. Increasing pod CPU limits and lowering the HPA target threshold to 60% stabilized the workload ahead of launch. Performing the cutover via wildcard alias records ensured uninterrupted service continuity.
Vibe DevOps Editorial Commentary
Operational Takeaways
Vibe DevOps Takeaway: When migrating legacy workloads into containers or Kubernetes, the greatest operational risks often stem from unverified assumptions around networking and caching layers. Teams should always execute production-grade load tests before redirecting real-world traffic.
Furthermore, having a fast edge-level rollback mechanism—such as via CDN routing rules or edge functions—is critical. Actively managing cache TTLs and calibrating pod health check parameters are vital to maintaining high availability.
⚠️ Operational Caveats & Limitations
- Using wildcard alias records in CloudFront requires matching SSL/TLS certificates and cannot be mapped directly to DNS apex domains.