Skip to content
Back to Blog
Linux & Server11 min read

Cloud Infrastructure Migration: 5 Risks That Break Deployments

Moving workloads to the cloud fails when teams skip these five deployment-breaking steps. Learn what actually goes wrong and how to prevent each risk.

Written by Abdul AbrorTechnical Hosting Support Engineer
Cloud Infrastructure Migration: 5 Risks That Break Deployments
On this page

I've watched dozens of cloud migrations stall or fail completely. Not because the cloud provider was bad, but because teams skipped basic steps they assumed would be handled automatically. The workload moved, then broke in production.

Most failures cluster around five predictable risks. Miss any one of them and you'll be rolling back at 2 AM.

Risk 1: Network architecture doesn't translate

On-premises networks use flat VLANs, private IP blocks, and hardware firewalls. Cloud networks are software-defined with VPCs, security groups, subnets across availability zones, and route tables.

Teams copy their existing network topology to the cloud without redesigning it. This creates bottlenecks immediately. A common mistake: putting every resource in a single subnet because that's how the old datacenter worked. When traffic scales, the subnet runs out of IPs or the routing becomes a single point of failure.

Map dependencies before you migrate

Document every service, its network dependencies, and which systems call it. I use a spreadsheet with columns for service name, IP/hostname, ports, protocol, and dependent services. For a typical web stack you'll find:

  • Web servers calling application servers on port 8080
  • App servers connecting to databases on port 5432 or 3306
  • Background workers pulling from message queues
  • Cron jobs hitting internal APIs
  • Monitoring agents sending metrics to collectors

Once you know the traffic flows, design the cloud VPC to match them. Separate subnets for web tier, app tier, data tier. Security groups that allow only the required ports between tiers. If the database accepts connections from the entire internet because you forgot to restrict the security group, that's a breach waiting to happen.

Test connectivity in a staging VPC first

Don't migrate production until you've run the full stack in a non-production cloud environment. Deploy each component, then verify:

# From app server, test database connection
telnet db.internal.example.com 5432

# Check if DNS resolves internal hostnames
nslookup app-internal.example.com

# Verify security group rules
aws ec2 describe-security-groups --group-ids sg-abc123

If telnet hangs, the security group or network ACL is blocking traffic. Fix it in staging, not production.

Risk 2: Application assumes local disk persistence

Many legacy applications write to /tmp, /var/cache, or a local upload directory. On a physical server that disk stays put. In the cloud, instances are disposable. When an instance terminates or scales down, local disk data vanishes.

I've seen upload handlers save files to /var/www/uploads on an autoscaling group. The user uploads a file, it lands on instance A. Five minutes later the load balancer routes them to instance B and the file is "missing." The application logs show no errors because the write succeeded—it just wrote to the wrong ephemeral disk.

Audit file I/O operations

Grep your codebase for file writes:

grep -r "fopen\|file_put_contents\|FileWriter\|os.Create" .
grep -r "/tmp\|/var" . | grep -v "^\.git"

For every write path, ask: does this data need to survive instance replacement? If yes, move it to object storage (S3, GCS, Azure Blob) or a mounted network volume (EFS, Cloud Filestore).

Session data is another trap. PHP applications often store sessions in /var/lib/php/sessions. Migrate to Redis or a database-backed session store so sessions survive instance churn.

Use stateless architecture patterns

The cloud rewards stateless design. Store application state in external services:

  • User uploads: S3 with presigned URLs
  • Cache: Redis or Memcached cluster
  • Sessions: DynamoDB, Redis, or database table
  • Logs: Centralized logging (CloudWatch, Stackdriver, Elasticsearch)

If you must use local disk for temporary scratch space, write to /tmp or the instance's ephemeral volume and ensure the application handles missing files gracefully.

Risk 3: Secrets are hardcoded or checked into repos

On a dedicated server you might store database passwords in /etc/myapp/config.ini with root-only permissions. That file never leaves the server.

In the cloud, configuration templates and AMIs get copied between regions and accounts. I've pulled production database credentials out of public GitHub repos, EC2 user data scripts, and even AMI snapshots shared with the wrong AWS account. If the secret is in the image or the repo, it will leak.

Externalize secrets immediately

Before you build your first cloud image, move secrets out of config files and into a secrets manager:

  • AWS: Secrets Manager or Parameter Store (SSM)
  • GCP: Secret Manager
  • Azure: Key Vault
  • Kubernetes: native Secrets or external-secrets operator

Your application fetches secrets at runtime:

import boto3

def get_db_password():
    client = boto3.client('secretsmanager', region_name='us-east-1')
    response = client.get_secret_value(SecretId='prod/db/password')
    return response['SecretString']
# In a shell script
DB_PASS=$(aws secretsmanager get-secret-value \
  --secret-id prod/db/password \
  --query SecretString \
  --output text)

Never pass secrets via environment variables in container definitions or user data visible in the console. Use the secrets manager integration (ECS secrets field, Kubernetes secretKeyRef) so the value is injected at runtime without being logged.

Rotate credentials after migration

If your old config files lived in Git or on shared drives, assume they're compromised. Generate new passwords for every database user, API key, and service account once the migration is complete. Revoke the old credentials.

So what if the infrastructure works but performance tanks?

Risk 4: Instance sizing is guesswork

Teams pick an instance type that "feels right" or matches the old server's CPU count. Then they discover the workload is memory-bound, or the network throughput caps out at 5 Gbps when they need 25.

Cloud pricing makes vertical scaling cheap to test, but only if you test before go-live. Undersized instances cause timeouts and slow page loads. Oversized instances waste money every hour.

Baseline resource usage before migrating

Install monitoring on the source servers at least two weeks before migration. Capture:

  • CPU utilization (average and peak)
  • Memory utilization (average and peak)
  • Disk I/O (IOPS and throughput)
  • Network throughput (Mbps in/out)
# On Linux, log resource usage every 60 seconds
sar -u -r -d -n DEV 60 > /var/log/sar-$(date +%F).log

# Or use vmstat
vmstat 60 >> /var/log/vmstat.log

Look for patterns. A web server might spike CPU during business hours but idle at night. A batch job might max out memory at 3 AM when the daily ETL runs.

Match instance types to the actual workload

If you see high CPU and low memory usage, choose compute-optimized instances (c5, c6i in AWS). High memory usage with moderate CPU points to memory-optimized (r5, r6i). Sustained disk I/O demands local NVMe or provisioned IOPS volumes.

Start with an instance type one size smaller than your baseline suggests, then load test. If CPU stays below 60% under peak load, you can downsize further. If it hits 90%, scale up. Monitor throttling metrics:

# AWS CloudWatch CPU credit balance for t3 instances
aws cloudwatch get-metric-statistics \
  --namespace AWS/EC2 \
  --metric-name CPUCreditBalance \
  --dimensions Name=InstanceId,Value=i-abc123 \
  --start-time 2026-08-04T00:00:00Z \
  --end-time 2026-08-05T00:00:00Z \
  --period 3600 \
  --statistics Average

If credit balance drops to zero, your burstable instance is CPU-starved. Switch to a fixed-performance type.

Risk 5: No rollback plan when things break

Migrations fail. A misconfigured load balancer health check marks all instances unhealthy. A DNS cutover points to the wrong endpoint. The cloud database has replication lag and serves stale data.

Without a rollback plan you're stuck troubleshooting in production while users see errors. I've watched teams spend six hours debugging a cloud deployment when rolling back to the old environment would have taken ten minutes.

Keep the old environment running in parallel

Don't decommission on-premises servers until the cloud workload has been stable for at least 72 hours under real traffic. Run both environments, ready to flip DNS back if needed.

Use weighted DNS or a low TTL during cutover:

# Route 53 weighted routing
old-datacenter.example.com  A  203.0.113.10  Weight: 90
cloud.example.com           A  198.51.100.5  Weight: 10

Send 10% of traffic to the cloud first. Monitor error rates, latency, and resource utilization. If metrics stay green for an hour, shift to 50/50, then 100%.

Document the rollback procedure

Write a runbook with exact commands to revert:

  1. Change DNS weights back to 100% old datacenter
  2. Wait for TTL to expire (check with dig +nocmd example.com +noall +answer)
  3. Verify traffic is flowing to old environment
  4. Stop cloud instances to prevent split-brain data writes

Test the rollback procedure in staging. Flip to cloud, break something intentionally, then roll back. Time how long it takes and identify gaps in the runbook.

Sync data bidirectionally until cutover is final

If you're migrating a database, set up replication from on-prem to cloud and from cloud back to on-prem. This is complex but prevents data loss. When you roll back, the on-prem database has all writes that happened in the cloud.

For file storage, run a bidirectional sync tool (rclone, rsync over VPN) until you're confident the cloud environment is permanent. Then cut off writes to the old storage.

What to check first when a migration stalls

Migrations break in predictable places. Start with these:

Network connectivity: Can the cloud instances reach the database? Try telnet db-host 3306 or nc -zv db-host 5432. If it times out, check security groups, NACLs, and route tables.

DNS resolution: Does the application resolve internal hostnames? Run nslookup internal-api.example.com from an instance. If it fails, configure VPC DNS settings or use Route 53 private hosted zones.

IAM permissions: Can the application read from S3 or write to CloudWatch? Check the instance IAM role and attach the necessary policies. Tail the application logs for "Access Denied" errors.

Secrets: Are database passwords pulled from the secrets manager? Add debug logging to confirm the application retrieves the secret and uses it for connections.

Disk persistence: Are uploaded files disappearing? Check if the application writes to local disk instead of object storage. Mount an EFS volume or refactor to use S3.

Resource limits: Is the instance out of CPU credits, memory, or disk? Check CloudWatch metrics or SSH in and run top, free -h, df -h.

Fix one thing, test, repeat. Don't change five settings at once or you won't know what worked.

FAQ

How long should I plan for a cloud migration?
Depends on complexity, but budget at least four weeks for a small stack (web server, database, storage) and three to six months for a large multi-tier application. Include time for testing, rollback drills, and running environments in parallel.

Can I migrate without downtime?
Yes, with database replication, DNS weighting, and parallel environments. Expect a brief maintenance window for final cutover, but you can minimize it to under five minutes if you've tested the procedure.

Should I migrate to containers or VMs?
If your application already runs in Docker, migrate to ECS, EKS, GKE, or AKS. If it's a traditional server application, VMs (EC2, Compute Engine, Azure VMs) are safer for the first move. Containerize later as a separate project.

What if my database is too large to migrate quickly?
Use database replication (MySQL binlog replication, PostgreSQL logical replication, AWS DMS) to copy data incrementally. The initial sync might take days, but replication keeps the cloud database in sync until cutover.

Do I need a site reliability engineer for this?
You need someone who understands networking, infrastructure as code, and the specific cloud provider's services. That might be an SRE, a DevOps engineer, or a senior sysadmin. Don't attempt this without that expertise on the team.

Migrate one service at a time

Move the lowest-risk workload first. A staging environment, a read-only reporting database, or a background job processor. Get comfortable with the cloud provider's networking, IAM, and deployment tools before you touch production web servers or transactional databases.

Run the new workload in parallel with the old one. Compare metrics: are response times the same? Are error rates unchanged? Does the monthly bill match expectations?

Once that first service is stable, migrate the next. Build momentum and knowledge incrementally. The all-or-nothing cutover is where teams get hurt.

Every migration I've seen succeed followed this pattern: small steps, constant testing, rollback always ready.