Skip to content

Migrating from cPanel to AWS without rewriting the application

Most cPanel-to-AWS moves do not require a rewrite. They require a clean mapping from cPanel concepts to EC2, RDS, S3, and Route 53 — done before the first instance launches.

A cPanel-to-AWS migration is often pitched as “lift and shift to EC2”. That works for a week, then the team discovers the EC2 instance is doing the work of cPanel, MySQL, Exim, and DNS all on one box, which was the problem on cPanel. The decision worth making before launching anything: which cPanel responsibility maps to which AWS service.

What’s happening

cPanel is a single host that owns everything. AWS gives you a separate service for each layer: EC2 (compute), RDS (database), S3 (file storage), SES (mail), Route 53 (DNS), ELB (load balancing), ACM (certificates). The migration’s quality depends on resisting the urge to put everything on one EC2 box. The cost difference between “EC2 doing it all” and “EC2 only running the app server” is usually 30–40% over a year because RDS, S3, and SES scale on usage while a fat EC2 idles at peak provisioned size.

How to verify

On the cPanel source, inventory each concern:

du -sh /home/<user>
mysqldump --no-data --all-databases | wc -l
ls /home/<user>/mail/* | wc -l
whmapi1 get_domain_info domain=example.com

On the AWS destination, confirm the regional building blocks:

aws ec2 describe-instances --region <region>
aws rds describe-db-instances --region <region>
aws s3 ls
aws ses get-account-sending-enabled
aws route53 list-hosted-zones

The fix

  1. DNS first — create the hosted zone in Route 53, leave NS pointing at the existing nameservers. Stage zone changes in Route 53 before flipping NS.
  2. Database — provision RDS MySQL with the same major version as cPanel (SELECT VERSION();). Replicate from cPanel using mysqldump --master-data or DMS for live cutover.
  3. File storage — mount the codebase in EFS or copy to EC2’s EBS. For uploads, push to S3 with a CloudFront in front; rewrite the application to point at the bucket URL.
  4. Mail — move sending to SES (verify the domain, publish SPF and DKIM). For receiving, either keep cPanel as MX or move to a service like Google Workspace.
  5. Compute — launch EC2 with Apache or Nginx, mount the codebase, point at RDS. Front with an ALB and ACM cert. Cut DNS only after the EC2 health check is steady-green for 24 hours.

The migration window is the moment the NS records change. Everything else runs in parallel. Stack Harbor builds these phased cutovers under migration solutions — book a migration review before allocating any AWS resources.