# Inter-Region Cloud Instance Migration

**1. Objective**

The objective of this setup is to implement **cross-region data replication** between two cloud instances using Rsync.

This includes:

* Deploying an Ubuntu Cloud Instance in the Indore region (Primary Site)
* Deploying an Ubuntu Cloud Instance in the Mumbai region (Target Site)
* Installing and configuring Rsync on both instances
* Transferring application data from Indore to Mumbai
* Verifying successful data synchronization
* Ensuring reliable and consistent data availability across regions

***

**2. Architecture Overview**

This architecture consists of two cloud instances located in different regions:

* **Primary Instance (Indore):**\
  Source of data where application data is generated
* **Target Instance (Mumbai):**\
  Destination where data is replicated

Data transfer is performed using **Rsync over SSH**, ensuring secure and efficient synchronization. Automation can be implemented using cron jobs for periodic updates.

***

**3. Prerequisites**

Before starting the data replication setup, ensure the following requirements are met:

***

**3.1 Infrastructure Requirements**

* One Ubuntu Cloud Instance in the Indore region (Primary)
* One Ubuntu Cloud Instance in the Mumbai region (Target)
* Public IP assigned to both instances
* Network connectivity between both instances

***

**3.2 Security Configuration**

* Secure communication is established using SSH
* SSH access is enabled on both instances
* Authentication is configured using SSH key-based authentication

**Security Note:**

> Data transfer between the two instances is secured using **end-to-end encryption via SSH**, ensuring confidentiality and integrity of data.

\
**4. Phase 1** : **Connect to Primary VM & Install rsync**

***

Step 1 : Connect to Primary VM(ssh)

Run from Local Laptop / PowerShell / Terminal(cmd)

```
ssh -i <PRIMARY_KEY>.pem ubuntu@<PRIMARY_PUBLIC_IP>
```

***

Step 2 : Update System

Run inside Primary VM(indore region)

```
sudo apt update && sudo apt upgrade -y
```

***

Step 3 : Install rsync

Run inside **Primary VM**

```
sudo apt install rsync -y
rsync --version
```

Expected output:

```
rsync version 3.x.x
```

<figure><img src="/files/zAXlCOrw6df8ycOFz321" alt=""><figcaption></figcaption></figure>

***

**5. Phase 2** : **Create Test Data on Primary VM**

***

Step 4 : Create Test Directory and Files

Run inside **Primary VM**

```
mkdir -p /home/ubuntu/dr-data
echo "DR Drill Test - Region A" > /home/ubuntu/dr-data/test.txt
dd if=/dev/urandom of=/home/ubuntu/dr-data/sample.bin bs=1M count=10
```

<figure><img src="/files/F27NXwrJwFGJXjgMKvCR" alt=""><figcaption></figcaption></figure>

***

Step 5 : Verify Data Creation

Run inside **Primary VM**

```
ls -lh /home/ubuntu/dr-data/
```

Expected Output:

```
sample.bin  (10MB)
test.txt
```

**7. Phase 3: Prepare SSH Access to Destination Instance (Mumbai region)**

***

Step 6 : Exit Primary VM

Run inside Primary VM

```
exit
```

***

Step 7: Copy DR SSH Key to Primary VM

Run from **Local Laptop**

```
scp -i <PRIMARY_KEY>.pem <DR_KEY>.pem ubuntu@<PRIMARY_PUBLIC_IP>:/home/ubuntu/.ssh/dr-key.pem
```

<figure><img src="/files/f6OAGnxVSG0Bw4PVIuJv" alt=""><figcaption></figcaption></figure>

***

Step 8: Login Back to Primary VM

```
ssh -i <PRIMARY_KEY>.pem ubuntu@<PRIMARY_PUBLIC_IP>
```

***

Step 9: Set Proper Permission

```
chmod 400 /home/ubuntu/.ssh/dr-key.pem
```

***

**8. Phase 4** : **Transfer Data from Primary to Destination Instance**

***

Step 10: Execute rsync

Run inside **Primary VM**

```
rsync -avz -e "ssh -i /home/ubuntu/.ssh/dr-key.pem -o StrictHostKeyChecking=no" \
/home/ubuntu/dr-data/ ubuntu@<DR_PUBLIC_IP>:/home/ubuntu/dr-data/
```

Expected Output:

```
sending incremental file list
created directory /home/ubuntu/dr-data
sample.bin
test.txt
```

<figure><img src="/files/cmzK9ncGlfHHxEvPhpcA" alt=""><figcaption></figcaption></figure>

***

**9. Phase 5** : **Verify Data on DR VM**

***

Step 11: Login to Destination Instance( Mumbai region)

Run from **Local Laptop**

```
ssh -i <DR_KEY>.pem ubuntu@<DR_PUBLIC_IP>
```

***

Step 12: Verify Transferred Data

Run on Destination Instance

```
ls -lh /home/ubuntu/dr-data/
cat /home/ubuntu/dr-data/test.txt
```

Expected Output:

```
sample.bin
test.txt
DR Drill Test - Region A
```

<figure><img src="/files/PgHbPqPcyOyBPey9qhG7" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.neevcloud.com/neevcloud-guide/neevcloud-remote-backup-and-dr/inter-region-cloud-instance-migration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
