How to Migrate from Cloud (AWS/GCP) to Bare Metal Without Downtime

Cloud to Bare Metal Migration Guide

To migrate AWS to bare metal, build the target environment while the cloud service remains live, copy your data, keep changes in sync, and test the new stack. Then transfer database write ownership and move production traffic. The same approach applies to Google Cloud, with different service settings and replication requirements.

Zero user-visible downtime is possible only when the application and migration design support it. Some databases need a setup restart or a short write pause. A site that loads while checkout fails is not fully available.

In this guide, we explain how to plan the move, protect accepted writes, test cutover, and recover if something goes wrong.

Can You Move from Cloud to Bare Metal Without Downtime?

You can keep a service available during migration when requests continue reaching a healthy application and that application uses consistent data. Database changes, background jobs, and open connections determine whether the move needs a write pause.

Separate these three outcomes before you set a migration date:

Outcome What users experience What the design needs
No user-visible interruption Reads and writes complete within normal service limits Tested routing, state continuity, and safe handling of brief backend changes
Short write pause Reads may work, but updates wait or are temporarily unavailable A controlled pause, final data sync, and a clear restart procedure
Planned outage The application is unavailable during part of the move A maintenance window, consistent backup or export, and tested recovery

A retry can hide a brief connection failure, but it can also repeat an order or payment. A safe retry must preserve the same operation identity and avoid duplicate effects.

If your application cannot safely queue or retry writes, plan a short maintenance window. Protecting completed transactions matters more than calling the migration “zero downtime.”

Why changing DNS is not enough

DNS tells clients where to connect. It does not copy a database, transfer sessions, stop an old worker, or move an open WebSocket connection.

During a DNS change, some clients may reach the old server while others reach the new one. Both application environments must use the correct data source, or the old environment must stop accepting writes.

A traffic split is safe only when it preserves a consistent application state. Sending half your customers to each of two independent writable databases can create conflicting orders, account updates, and inventory counts.

Decide What to Move and What to Keep in the Cloud

Move workloads when the target fits their performance, recovery, and operating needs. You do not need to remove every cloud service to benefit from dedicated hardware.

Cloud repatriation means moving workloads from public cloud infrastructure to another environment, such as rented dedicated servers or owned hardware. A bare metal server gives you dedicated physical resources. Your team must still design and operate the application, storage, and recovery layers.

At Atal Networks, we recommend starting with a workload inventory rather than a target server price. A lower hosting bill helps only if the new environment still meets your service requirements.

Workload condition Migration approach to assess
Steady compute demand with known peaks Move compute after measuring target performance
Portable application with PostgreSQL or MySQL Rebuild the application and use a supported database migration path
Heavy dependence on managed analytics or serverless services Retain those services or budget for application changes
Large, unpredictable traffic spikes Keep cloud capacity or provision enough tested spare capacity
Small team without database or systems support Compare managed help with the cost of staying in the cloud
Strict recovery requirements Design failure tolerance and restore procedures before comparing prices

Map AWS and GCP services to target options

Cloud services provide more than a place to run code. Record what each service does before you choose a replacement.

Function AWS or GCP service Possible target What needs checking
Application compute EC2, Compute Engine OS services, containers, or VMs on dedicated hardware CPU architecture, libraries, credentials, licensing
Relational database RDS, Cloud SQL Compatible self-managed engine or retained cloud database Replication, extensions, backups, failover
Object storage S3, Cloud Storage Retained service or suitable object storage API behavior, metadata, versions, signed URLs
Cache and sessions ElastiCache, Memorystore Retained service or supported replacement Session continuity and persistence requirements
Background messaging SQS, Pub/Sub Retained service or a selected message broker Ordering, retries, delivery behavior
Container platform EKS, GKE A target Kubernetes cluster Storage drivers, networking, identity, control plane
Secrets and identity IAM, service accounts, secret stores Retained identity or a new access model Least privilege, authentication, key rotation
Monitoring CloudWatch, Cloud Monitoring Retained or replacement monitoring Logs, metrics, alerts, retention

These options are not identical substitutes. For example, a queue with different delivery behavior may require code changes.

Keeping S3 for backups or a cloud email service can reduce the scope of the move. Keeping a database in the cloud while moving its application needs more care: each database round trip now crosses the connection between providers. Test that path under real application load.

Step 1: Audit the Source and Define Success

A useful migration audit identifies every component that serves requests, stores data, or creates side effects. It also defines the conditions that must pass before production traffic moves.

Build a dependency inventory

Record more than virtual machines and database sizes. Include scheduled jobs, payment callbacks, upload paths, internal APIs, and external IP allowlists.

Use a worksheet with these fields:

Component Current location Move or retain Test Owner
Web application EC2 or Compute Engine Move Login, read, and write flows Application team
SQL database RDS or Cloud SQL Move Replication and business-data checks Database owner
Uploaded files Bucket or shared filesystem Decide Upload, download, permissions Application team
Scheduled billing job Worker or scheduler Move One job owner; no duplicate charge Operations team
Transactional email External service Retain Authentication and delivery Application team

Check for cloud-specific behavior in the application. An EC2 instance profile, Google service account, metadata endpoint, or private cloud hostname may stop working on the target.

Measure the workload before sizing hardware

Collect data across a representative business cycle, including busy periods and scheduled work:

  • CPU use and periods of CPU saturation.
  • RAM working set, cache use, and swap activity.
  • Storage capacity, growth, read/write rates, and disk latency.
  • Peak requests, concurrent connections, and database write rate.
  • Network throughput, packet loss, and cross-service latency.
  • Error rate and p95/p99 response time.

The p95 response time is the time within which 95% of measured requests finish. It helps show whether a small group of users experiences slow service even when the average looks acceptable.

Do not convert cloud vCPUs directly into physical cores. Processor model, architecture, per-core speed, memory, and workload behavior affect the result.

Set data-loss and recovery targets

Define three terms in the migration plan:

  • Recovery point objective (RPO): how much recent data loss the business can accept.
  • Recovery time objective (RTO): how long recovery can take after a failure.
  • Service-level objective (SLO): the service target, such as request success rate or response time.

Then set a separate limit for the planned write pause. RTO is a recovery target, not permission to use the entire period for routine cutover.

For an order system, the acceptance rule might be: every committed order before the write fence must exist on the target before it starts accepting new orders. That is a requirement to prove, not a result to assume from a green replication status.

Assign one person to approve cutover and one to stop it. Our guide to data center migration risks covers the wider planning and recovery issues.

Step 2: Build and Test the Bare Metal Environment

Prepare the target as a production system before copying live traffic to it. A successful application start is only the first check.

Size capacity and failure tolerance

Choose hardware from measured demand, including space for growth and maintenance. Check usable storage after RAID or other redundancy, rather than adding the raw drive sizes.

One physical server may run the entire workload, but it also creates a shared failure point. If the cloud design survives a host or availability-zone failure, replacing it with one server changes the availability model.

Adding a second server does not solve every failure. Shared power, switching, storage, or a single load balancer can still stop both systems. Define which failures the target must survive and test them.

RAID can protect service during some drive failures. It does not replace an independent backup that you can restore after deletion, corruption, or compromise.

For an Atal Networks deployment, use the selected configuration and confirmed service terms as planning inputs. Record who manages the OS, database, backups, and failover. Do not infer those responsibilities from hardware support alone.

Rebuild the application and its operating environment

Use a known application release during migration. Avoid adding an unrelated database major-version upgrade or application redesign to the same change window.

Before testing, prepare:

  1. A supported OS, required packages, and the correct application runtime.
  2. Users, SSH access, firewall rules, and a restricted management path.
  3. TLS certificates, application secrets, and service credentials.
  4. Deployment automation and a known rollback release.
  5. Logs, metrics, alerts, and time synchronization.
  6. Backups and a tested restore location.
  7. Remote console access and a documented recovery contact.

Keep database and hardware management interfaces away from unrestricted public access. Use encrypted connections and narrowly scoped access rules for migration traffic.

Check container and Kubernetes dependencies

Moving an image does not move its persistent data or cloud integration.

For EKS or GKE workloads, check storage classes, persistent volumes, load balancer behavior, ingress, network policy, registries, and workload identity. A manifest that asks for a cloud disk cannot create the same disk on bare metal without a suitable storage integration.

You do not need Kubernetes for every migration. A small application may be easier to operate with containers or standard OS services. Keep the platform choice tied to the team’s needs and skills.

Step 3: Copy Data and Keep Changes in Sync

For a busy database, use an initial consistent copy followed by ongoing replication or change data capture. This moves most of the data before the final cutover window.

Change data capture, or CDC, records data changes so a target can apply them after the initial copy. The exact method depends on the source engine and service.

Choose the supported database path

Source Path to assess Checks before starting
RDS for PostgreSQL Logical replication to a compatible PostgreSQL target Roles, source settings, restart requirements, table coverage
Cloud SQL for PostgreSQL Supported logical replication or external-replica configuration Flags, versions, extensions, connectivity
RDS for MySQL Export using replication to external MySQL Compatible version, consistent copy, binary logs
Cloud SQL for MySQL External replica followed by the documented primary change Replica requirements, final sync, application outage behavior

This table does not cover every Aurora variant, database engine, or managed-service configuration. Check the specific source product before selecting a procedure.

RDS PostgreSQL to self-managed PostgreSQL

RDS supports PostgreSQL logical replication. AWS documents the required roles and the rds.logical_replication setting. Applying this static setting requires a reboot, so include that preparation event in the service plan.  

Also monitor replication slots. A slot can retain write-ahead log, or WAL, while a consumer falls behind. A stalled migration can therefore consume source storage before you reach cutover.

Use a compatible target and keep application writes disabled there during the copy. Check that the initial table copies finish and that ongoing changes continue applying without errors.

Cloud SQL PostgreSQL to self-managed PostgreSQL

Google Cloud documents logical decoding through cloudsql.logical_decoding. Its configuration guide notes restart requirements for the relevant flag changes. If your path uses pglogical, check the required extension settings on both sides.  

Do this work before the final cutover window. A procedure that keeps traffic working during the last switch may still have required a preparation outage.

Check database objects as well as rows

For PostgreSQL 17 native logical replication, schema changes and sequence state need separate handling. Large objects are also outside the normal table replication path. Use the documentation for your chosen version, because features can change. 

For example, copied order rows may contain IDs up to 850,000 while the target sequence still starts near its initial value. The first new order can then fail with a duplicate-key error. Set the sequence state safely after source writes stop and before target writes begin.

Review roles, permissions, extensions, table coverage, and how updates and deletes identify rows. Keep schema deployments frozen or follow a tested procedure for applying compatible changes to both sides.

RDS MySQL to an external MySQL server

AWS provides an export procedure that copies a database and uses replication to catch up an external MySQL target. The target must use the same version or a supported later version. AWS describes this external replication support for the export period, not as an unrestricted permanent design.  

Check binary-log retention, backup consistency, privileges, and the correct transaction-position method. If the source removes required logs before the target reads them, you may need to seed the target again.

Cloud SQL MySQL to an external server

Google’s documented path uses an external replica, waits for synchronization, changes application access, and changes the primary role. The procedure explicitly includes taking applications offline. Use it as a minimal-downtime path unless a separate, tested application design covers that interruption.  

Do not promise continuous writes just because the initial data copy runs online.

Move uploads, sessions, and queue state

Database replication does not move every piece of application state.

State Migration treatment
User uploads Initial copy, ongoing changes, and a final sync after relevant writes stop
Object storage Check keys, metadata, access rules, versions, deletions, and encryption access
Disposable cache Rebuild if safe; allow for the load of a cold cache
Login sessions Keep a shared session store or plan and disclose session loss
Queued jobs Preserve pending work and assign one processing owner
Scheduled tasks Disable the old schedule before enabling the new owner

Do not copy an active database directory with a file-sync tool and assume the result is consistent. Use a database-aware backup or replication method.

For objects, use a checksum method that fits the provider and upload type. An object ETag is not always a plain file-content checksum, as the Amazon S3 integrity documentation explains. Count objects, check representative content, and test the application paths that read them.

Step 4: Rehearse the Migration Before Production Cutover

A rehearsal should prove that the target handles normal work, peak demand, and recovery. It should also measure how the application behaves during the final data switch.

Test user journeys and data consistency

Use a staging hostname with correct TLS. Test the same release that will receive production traffic.

 

Test Evidence to record
Login and account access Existing sessions behave as planned; permissions remain correct
Create and edit data Writes reach the intended database and remain visible
Checkout or payment Test transactions complete once; retries do not repeat charges
Upload and download New files persist and existing files remain readable
Background jobs Pending work completes without duplicate side effects
Data checks Counts, selected checksums, recent rows, and business totals agree
Peak traffic Errors and latency stay within the agreed limits
Backup restore A separate restored copy opens and passes application checks

Compare data at a consistent point. A changing source and a slightly delayed replica can show different totals even when replication works correctly.

Keep test writes out of the production replication target. Use an isolated copy for write tests unless the test design explicitly handles the resulting changes. Replayed traffic must not send real emails, payments, or webhooks.

Test the stop conditions

Before cutover, agree to stop if:

  • Required data is missing or replication reports errors.
  • The target cannot catch up under normal write load.
  • The restore test fails.
  • A critical user flow fails.
  • The team cannot stop every source writer.
  • The target exceeds agreed resource or response-time limits.

Do not compensate for a failed test by extending the maintenance window without a decision from the change owner.

Step 5: Cut Over Traffic Without Losing Accepted Writes

The cutover must transfer write ownership in a controlled order. Keep one authoritative writable database for this migration pattern.

“Write fencing” means preventing the old environment from accepting changes after the final source boundary. It includes web requests, workers, scheduled tasks, and administrative access that could change data.

Prepare routing and connection handling

If DNS will change, lower its time to live, or TTL, early enough for records cached under the previous TTL to expire. Changing a one-hour TTL to five minutes just before cutover does not shorten existing one-hour cache entries.

Check IPv4 and IPv6 records, CDN settings, TLS certificates, origin health checks, and external allowlists. Plan how to drain long-lived connections.

A stable reverse proxy or load balancer can make backend switching easier, but confirm that it can reach both environments and that its health checks reflect application readiness. A CDN cache hit does not prove that the target can process a database write.

Follow a single-writer cutover sequence

  1. Freeze unrelated changes. Stop application releases and schema changes for the agreed window.
  2. Pause new source writes. Use the rehearsed application mechanism. Stop workers and schedules that can change data. Drain or resolve in-flight transactions.
  3. Confirm the final source boundary. Record the engine-specific transaction or log position. Prove that all in-scope replication streams have applied the required changes.
  4. Finish state checks. Complete the final upload sync and required sequence or object work. Keep the target closed to application writes until these checks pass.
  5. Prepare target write ownership. Follow the chosen tool’s procedure to stop inbound replication where needed. Change database endpoints and refresh connection pools. Keep the source fenced.
  6. Route and resume. Enable target writes, assign the target worker owner, and route traffic through the tested path. Check a real permitted transaction end to end.
  7. Observe before removing the source. Watch errors, response times, queues, recent writes, and business totals.

The exact database commands depend on the engine, version, and migration tool. A PostgreSQL logical subscriber does not use the same promotion procedure as a physical standby.

A small lag number is not the final acceptance test. It may describe only one stream, omit a table, or reflect a received change that has not yet been applied. Use the engine’s applied-position evidence and your data checks.

Keep the old application from writing to stale data

Clients may still reach the old address after the switch. Decide beforehand how those requests behave.

The old application can forward requests to the new environment, use the new authoritative database if tested, or display the planned maintenance response. It must not continue writing to the old database.

Stage Production writer Required check Safe return option
Initial copy Cloud source Copy and change stream work Stop the target build
Rehearsal Cloud source Tests pass on isolated state Correct the target and repeat tests
Final sync Source writes stopped Final committed changes reach target Resume source if no target production writes occurred
Target activation Bare metal target New writes and key user flows succeed Application rollback may be possible; data return needs a separate plan
Observation Bare metal target Peak traffic and scheduled work pass Use the tested recovery procedure

Worked example: an online store moves off AWS

Consider a hypothetical store with two EC2 application instances, RDS for PostgreSQL 17, S3 product images, and a queue for order emails. This is an illustrative design, not a measured Atal Networks customer migration.

The team keeps S3 and the email service. It builds the application and PostgreSQL target on dedicated hardware, with database recovery and spare capacity sized to the store’s requirements.

During replication, the live store continues writing to RDS. The team tests checkout on an isolated target copy and confirms that payment retries use a stable idempotency key.

At cutover, the team pauses checkout writes, drains in-flight orders, stops order workers, and confirms that the target contains the final committed orders. It completes the PostgreSQL sequence work, changes the database endpoint, and starts the new worker owner.

This design includes a write pause. To make that pause invisible to shoppers, the application would need a proven way to hold requests durably, preserve payment behavior, and complete them within acceptable time limits. Without that mechanism, describe the result honestly as a short checkout interruption.

The store’s success test is not just a green home page. A customer must be able to submit an order once, see it in order history, and receive the correct confirmation.

Step 6: Choose the Correct Rollback Path

Rollback changes after the target accepts its first production write. Before that point, the source may still be current. After that point, the source may be missing accepted customer changes.

Before the target accepts writes

If the source remains authoritative and no production writes reached the target, return traffic to the source, restore its worker ownership, and resume writes through the rehearsed procedure.

Confirm the condition first. A test endpoint, worker, or administrator may have written to the target unexpectedly.

After the target accepts writes

Do not simply point DNS back at the old environment. Preserve the target’s new data and choose between application rollback, data failback, and forward repair.

Recovery action When it can help Required condition
Application rollback A new application release or target configuration fails The older application can use the current database schema and target data
Data failback The database must return to the source environment A tested reverse path and complete handling of target writes
Forward repair The target has current data and a repair is safer than return A controlled fix, recovery copies, and agreed service handling

If an order exists only on the target, a return to the stale source can make it disappear from the application. Keep an incident record of accepted operations, logs, and any queued work.

Reverse replication is not a switch to enable casually during an incident. It needs compatible schemas, permissions, log retention, and a method that avoids loops or conflicting writes. Rehearse it if data failback is part of the promised recovery plan.

Step 7: Monitor Production and Retire Cloud Resources

The migration is complete when the target passes real workload and recovery checks, and the team has removed unused dependencies safely.

Observe at least the traffic peaks and scheduled jobs that matter to your application. The correct observation window may include daily billing, weekly reports, or another business cycle. There is no universal 24-hour rule.

Monitor:

  • Request errors and p95/p99 latency.
  • Database connections, slow queries, and storage latency.
  • CPU, RAM, disk capacity, and network limits.
  • Queue depth and failed jobs.
  • New orders, account changes, and file access.
  • Backup completion and restore results.
  • Hardware alerts and support ownership.

After sign-off, remove temporary replication resources, unused credentials, old endpoints, and unneeded cloud resources. Retained replication slots or logs can consume storage. Unused disks, load balancers, addresses, and backup copies can continue billing.

Keep required records and recovery copies. Confirm that cloud services you chose to retain still work after the old compute is removed.

How Long Does Cloud-to-Bare-Metal Migration Take?

Migration time depends on data size, effective transfer speed, ongoing change rate, application complexity, and rehearsal results. The initial copy can take hours while production remains online; the final write pause is a separate measurement.

Calculate initial copy time

Use measured effective throughput rather than the network port’s advertised speed.

Copy time in seconds = data size in bytes × 8 ÷ effective bits per second

For a hypothetical 2 TB dataset, using decimal units and an effective rate of 400 Mb/s:

2,000,000,000,000 × 8 ÷ 400,000,000 = 40,000 seconds, or about 11.1 hours.

That figure covers transfer time only. Add backup creation, database loading, index work, retries, checks, and replication catch-up where applicable.

Check whether replication can catch up

The target must apply changes faster than the source produces them over the period when it needs to reduce a backlog.

As a simplified example, a 20 GB backlog with a 50 MB/s apply rate and 10 MB/s of new changes takes about 500 seconds to clear. That assumes comparable units, constant rates, and no other bottleneck. Real database replay must be measured because transaction types and contention change the work required.

Atal Networks’ 10Gbps dedicated server options may suit high-throughput workloads, but a faster target port cannot fix a slow source export, limited disk writes, or an overloaded replication process. Test the complete path before selecting capacity.

Compare Full Operating Cost Before Leaving AWS or GCP

Compare cloud and bare metal at the same availability and support level. A single server can cost less than a multi-zone cloud design partly because it provides a different failure model.

Cost group Include in the comparison
Target infrastructure Servers, storage, network options, addresses, licenses
Failure capacity Replicas, spare capacity, load balancing, recovery location
Data protection Backup storage, retention, restore work, recovery tests
Operations Monitoring, patches, database care, on-call time, support
Retained cloud services Storage, email, identity, analytics, queues
Migration Engineering time, rehearsal, overlap period, transfer charges
Existing commitments Remaining committed spend and contract obligations

Use two simple calculations:

Monthly net savings = current comparable monthly cost − full target monthly cost − retained cloud monthly cost.

Payback period = one-time migration cost ÷ positive monthly net savings.

For illustration, a $4,000 current monthly cost, $2,200 combined target and retained-service cost, and $9,000 migration cost produce $1,800 in monthly savings and a five-month simple payback. These are sample inputs, not Atal Networks prices or a savings forecast.

AWS and Google Cloud have exit-related transfer programs with conditions. Check the applicable account, service scope, process, and timing before entering a credit in your budget. A hybrid move does not automatically qualify. See the AWS EC2 FAQ and Google Cloud exit procedure.

Common Cloud-to-Bare-Metal Migration Problems

Most cutover problems come from missing dependencies, incomplete state, or unclear write ownership. Use symptoms to choose the next check.

Symptom Likely cause Check and action
Replication stops Schema mismatch, permission problem, or missing log data Read the replication error; correct the cause before restarting cutover
Source disk use grows Retained WAL or binary logs Inspect replication progress and retention; do not remove needed logs blindly
Lag keeps growing Apply capacity below change rate Measure target writes, transaction load, and network throughput
Duplicate emails or charges Old and new workers both process work Stop duplicate consumers; check idempotency and job ownership
Login sessions disappear Session state or signing keys changed Check session storage, cookies, and secrets
New uploads are missing Final sync or write path is incomplete Check object references and every active upload destination
Only some users see failures DNS caches, IPv6, TLS, or old allowlists Test both addresses and review client connection paths
Queries slow after compute moves Database round trips now cross providers Measure end-to-end query latency and connection reuse
Target fails during a peak Sizing or cold-cache limits Compare the failed workload with rehearsal results and resource data
Rollback loses recent changes Traffic returned to a stale source Stop further damage, preserve target data, and use the data recovery plan

Frequently Asked Questions

Can I migrate AWS to bare metal without downtime?

Yes, if the application keeps requests working during the transfer of traffic and data ownership. That requires tested state handling, connection behavior, and safe retries or queuing. Some workloads need a short write pause. Replication setup may also require an earlier restart, so assess the entire migration rather than only the final switch.

Can I move Amazon RDS data to a dedicated server?

Yes. RDS for PostgreSQL and RDS for MySQL provide documented replication or export paths for compatible targets. The method depends on the engine, version, permissions, and deployment type. Check database objects as well as table data, and test the application before the target receives production writes.

Can Google Cloud SQL replicate outside Google Cloud?

Cloud SQL supports external replication paths for supported PostgreSQL and MySQL configurations. Check the documentation for your engine and version. Setup flags, network access, and the primary-change procedure differ. Google’s MySQL migration procedure includes an application outage step, so it should not be presented as a guaranteed zero-downtime process.

Can I keep S3 or Cloud Storage after moving compute?

Yes. A hybrid design can retain object storage, backups, email, or other useful services. Check credentials, request latency, transfer costs, and application behavior from the new location. Confirm that any cloud exit-credit conditions still fit the services you plan to retain.

Does lowering DNS TTL prevent downtime?

No. A lower TTL can shorten future DNS caching, but it does not change records already cached under the old TTL. It also does not drain open connections, copy data, or stop old workers. Keep the old request path safe until traffic has moved and its remaining activity is understood.

Is Kubernetes required for cloud repatriation?

No. You can run applications as OS services, containers, or virtual machines on dedicated hardware. Kubernetes can suit teams that already need its orchestration features. It also adds control-plane, storage, and network responsibilities. Choose the operating model your team can support, rather than adding Kubernetes solely for the migration.

Can I roll back after the new database accepts writes?

You can recover, but returning traffic to the old database may lose recent changes. An application rollback may keep using the current target data if the older code remains compatible. Data failback requires a tested return path or reconciliation. Decide which option applies before production cutover.

How long does a cloud-to-bare-metal migration take?

There is no fixed duration. Measure initial copy time, replication catch-up, testing, and the final write pause separately. A large copy can run while production stays online. Complex managed-service dependencies, slow source reads, and failed rehearsals can take longer than the network transfer itself.

Scroll to Top