# How to Migrate a Server from Ace Cloud to AWS?

This guide provides a step-by-step process for migrating a Ubuntu server from Ace Cloud to AWS. The process involves creating snapshots, converting them into images, and transferring these images to AWS.

### Step 1: Create a Snapshot <a href="#step-1-create-a-snapshot-of-the-openstack-server" id="step-1-create-a-snapshot-of-the-openstack-server"></a>

To create a snapshot, follow the steps below:

a. [Login](https://customer.acecloudhosting.com/index.php?m=ace_product_register_addon\&action=login) to your account.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2F3vxwAGfrxQkNm6PRhJ5A%2Fimage.png?alt=media&#x26;token=f15004b9-ab89-41d9-bf28-45fabaa895e8" alt=""><figcaption></figcaption></figure>

b. Navigate to **Compute** and then click on **Instances**.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FJeAJHbKxAM7gdNl4IhRE%2Fimage.png?alt=media&#x26;token=4157c0d6-6f70-4426-b2a8-8603acb36e2c" alt=""><figcaption></figcaption></figure>

e. Select the Instance from the list and click on the action icon.&#x20;

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FcwSqnEMfU4uetLFeJMZT%2Fimage.png?alt=media&#x26;token=6279a3e2-fb2f-45a8-a92f-c0fdc88a703c" alt=""><figcaption></figcaption></figure>

f.  Choose **Create Snapshot.**

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FACQ0FHXkGlXTgqCAcCzK%2Fimage.png?alt=media&#x26;token=a61dac83-c457-457b-816f-798e7211bbd5" alt=""><figcaption></figcaption></figure>

g. Enter the **Snapshot Name** and hit **Submit**.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2F1xj1jqqcmTcjDY8F39TK%2Fimage.png?alt=media&#x26;token=042c2114-9800-4079-a0b0-e189f25f7679" alt=""><figcaption></figcaption></figure>

### Step 2: Create Volume from the Snapshot <a href="#step-2-create-volumes-from-the-snapshots" id="step-2-create-volumes-from-the-snapshots"></a>

a. Navigate to **Storage** then click on **Volumes**, locate the volume created from the snapshot.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FieKDeckcr1wd7YoTjZKy%2Fimage.png?alt=media&#x26;token=bd65801c-d093-43d4-a11a-7eae20731e4b" alt=""><figcaption></figcaption></figure>

**b.** Click the **Create Volume** button.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FNDK1Q54rxM58SCMGijlH%2Fimage.png?alt=media&#x26;token=61b373e1-f591-47f5-897d-357257453a70" alt=""><figcaption></figcaption></figure>

c. Enter the **Volume Name** and set the **Volume Size** as needed.

d. In the **Volume Source** dropdown, select **Snapshot** and choose the appropriate snapshot from the list.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FzFpamBGYGVfd0X0Eho2j%2Fimage.png?alt=media&#x26;token=d75b86ad-a562-4dcd-ba5a-798cde77656d" alt=""><figcaption></figcaption></figure>

e. Click **Submit**.

### Step 3: Upload Volume to Glance as Image <a href="#step-3-upload-volumes-to-glance-as-images" id="step-3-upload-volumes-to-glance-as-images"></a>

a. Click on **Utilities,** then on **User**.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2F9rOhfQ0fljFf9RvQRQ5W%2Fimage.png?alt=media&#x26;token=19c684d2-12fc-4c3d-a6da-c67527378c9c" alt=""><figcaption></figcaption></figure>

b. Click on **Create User**.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FSDDzFruqZRrFRPdL9m0s%2Fimage.png?alt=media&#x26;token=4b700557-5dea-4d4b-acbc-e9c4c0da73eb" alt=""><figcaption></figcaption></figure>

c. Enter the **Username** and **Description** for the user and click on **Create User**.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FMX1fDN1xw6p8l2RscLHr%2Fimage.png?alt=media&#x26;token=36447a27-a002-44ec-b08d-14d280a8baba" alt=""><figcaption></figcaption></figure>

d. Click on **Download** to save the user credential.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FgIXMRjONJfr4M4WM5gco%2Fimage.png?alt=media&#x26;token=4149d7ce-2b5f-4d46-830d-4a8677612f44" alt=""><figcaption></figcaption></figure>

e. Login to the [horizon portal ](https://console.openstack.acecloudhosting.com/auth/login/?next=/identity/users/)with the credential created above.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FXlSr8WqaKT96WRjIOJG0%2Fimage.png?alt=media&#x26;token=61d3f438-b9e2-4597-9ecb-39141a8cc0cd" alt=""><figcaption></figcaption></figure>

f. Navigate to the **Volumes** tab and click on **Volumes**.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FRtr5iUujMwtXA9OFKShx%2Fimage.png?alt=media&#x26;token=f34edad3-d0e2-4bdc-8362-0fca9c523a98" alt=""><figcaption></figcaption></figure>

g. Select the volume from the list and click on the action icon. Select the **Upload to Image** option from the dropdown.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FnQ23HZurOK3oSiZDlQv1%2Fimage.png?alt=media&#x26;token=d7a37688-8f6a-4e7c-b2ea-f9b085a6b2c3" alt=""><figcaption></figcaption></figure>

h. Enter the **Image Name** and select the **Disk Format** (e.g., `qcow2`). Click on **Upload**.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FemMAEuSsLt7xnVmjt2fo%2Fimage.png?alt=media&#x26;token=993f6255-331a-49b5-87f9-2353d76c0f2f" alt=""><figcaption></figcaption></figure>

### Step 4: Download Images Using OpenStack CLI <a href="#step-4-download-images-using-openstack-cli" id="step-4-download-images-using-openstack-cli"></a>

**i. Access a server with sufficient disk space:** Ensure the server has enough volume space to store the images that will be downloaded.

**ii. Install and configure OpenStack CLI on the server: I**nstall the OpenStack CLI using the below command:

```
sudo apt-get install python3-openstackclient -y
```

**iii. Download the RC file from the horizon dashboard:**

To download the RC file, follow the below steps:

a. Login to the [horizon portal ](https://console.openstack.acecloudhosting.com/auth/login/?next=/identity/users/)with the credentials created above.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FeQIZpnqg11qzQj2wmnPg%2Fimage.png?alt=media&#x26;token=fb6ba977-d212-4288-b094-db915eb39dd4" alt=""><figcaption></figcaption></figure>

b. Click on the region in the top-left corner and select the region.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FwfURSOTdrgmXcClvC2Lb%2Fimage.png?alt=media&#x26;token=560db72a-0c33-4f63-afa3-e9977ad0069c" alt=""><figcaption></figcaption></figure>

c. Click on the user icon in the top-right corner.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2F958SzKoK0PUzkv8YxUOu%2Fimage.png?alt=media&#x26;token=138e80ee-1459-44a1-8ad2-d977f5d78056" alt=""><figcaption></figcaption></figure>

d. Click on **OpenStack RC File** to download the RC file.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FqJ17stwzY6rmgiV2nJ3M%2Fimage.png?alt=media&#x26;token=55e68fc2-03a5-4df9-b6d5-422c025cbf4d" alt=""><figcaption></figcaption></figure>

iv. Use the following command to list images and check their status:

```
openstack image list | grep -i <Image-Name>
```

**Note:** Replace `<Image-Name>` with the name of the image you uploaded.

**v. Wait for the images to be in the "active" state:** The image should be in the "active" state before proceeding to download.

**vi. Download the image using the Glance client:**

a. Once the image is active, use the following command to download it:

```
glance image-download --file <Image_Name> <Image-ID> --progress
```

&#x20;**Note:** Replace `<Image_Name>` with the desired name for the downloaded image file and replace `<Image-ID>` with the ID of the image.

### **Step 5: Upload Images to AWS S3**

**a. Configure AWS CLI on the server:**

```
//Installing AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
apt install unzip -y
unzip awscliv2.zip
sudo ./aws/install
aws configure
//Enter you credentials
```

Enter your AWS credentials and set the default region.

**b. Upload the images to AWS S3:**

```
aws s3 cp <Image-name> s3://<Bucket_Name>/
```

**Note:** Replace `<Image_Name>` with the name of the downloaded image file and replace `<Bucket_Name>` with the name of your S3 bucket.

### Step 6: Register Images as AMIs in AWS <a href="#step-6-register-images-as-amis-in-aws" id="step-6-register-images-as-amis-in-aws"></a>

**a. Import the images as AMIs:**

```
aws ec2 import-image \
    --description "Description" \
    --disk-containers "Format=RAW,UserBucket={S3Bucket=ace-pc-cloudevopsteam, S3Key=logo/Ubuntu-20.04-ovh}"
```

**Note:** Replace `<Image_Description>` with a description of the image, `<Bucket_Name>` with your S3 bucket name and `<Image_path>` with the key of the image file in S3.

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FFZDchnpcTzOgsbDnyWvb%2Fimage.png?alt=media&#x26;token=dd7b7971-0a7a-478e-8bd7-9afa4958531e" alt=""><figcaption></figcaption></figure>

**b. Monitor the import status:**

```
aws ec2 describe-import-image-tasks --import-task-ids <Import_Task_ID>
```

**Note:** Replace `<Import_Task_ID>` with the ID returned from the `import-image` command.<br>

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2F7fcOZQ1RgEn8I58AQOPd%2Fimage.png?alt=media&#x26;token=8ad4fc19-1de0-4a16-8e9d-b4f74d3124cb" alt=""><figcaption></figcaption></figure>

Let it complete.<br>

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2FkBZVBqA7oKFCMJrbpmYk%2Fimage.png?alt=media&#x26;token=620f46de-6d67-4934-91e0-d284c020c117" alt=""><figcaption></figcaption></figure>

**c.** Once the import is complete, the image will be available in the AMI section of AWS EC2. You can find it under **Images > AMIs** in the AWS Management Console.<br>

<figure><img src="https://2309219721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAttkclnlvS7mshXw1NRn%2Fuploads%2Fsh5laH5OMjLzQIWOVRVh%2Fimage.png?alt=media&#x26;token=37e6ced0-4908-43af-9af8-42a8bad018b7" alt=""><figcaption></figcaption></figure>

d. Using this uploaded image, you can launch your instance.
