How to migrate an instance from one OpenStack provider to another
Estimated time to read: 3 minutes
In this tutorial, we will show you how you can migrate an instance with ephemeral storage from one OpenStack provider to another OpenStack provider using snapshots. There are several ways of migrating instances and probably even some forms of doing this without any downtime, but this tutorial describes one of the most basic and easiest ways of doing it, using the OpenStack CLI tools.
Note: This tutorial was tested on Fuga Cloud Release 1 and Release 2 using the OpenStack CLI version 3.17.0
TIP: We recommend using a small Linux cloud instance on the destination platform with the OpenStack CLI tools installed. This way you can make full use of the fast connections of the cloud platforms instead of downloading it to your local machine. This really speeds up the process.
- 2 active OpenStack accounts
- OpenStack CLI tools installed
- A cloud instance (that you would like to migrate)
- OpenStack credentials (open.rc files) from both OpenStack providers.
step 1: Creating a Snapshot
Before creating a snapshot, shut down the instance to ensure no data is lost in transit. This to prevent data corruption.
You can view the instance name of your instance, using the following command:
Let’s shut down your instance, so that we can take a snapshot.
Now we are going to create a snapshot of your instance using the following command:
You can check the status of your snapshot
If the status is Active your snapshot is completed
Step 2: Download your snapshot
We need the image ID of the snapshot that you’ve just made. We can look up the image ID with the following command.
After you have your image ID, it’s time to identify and download your snapshot, replacing
Step 3: Uploading your snapshot
Make sure you are logged in to the correct OpenStack provider with your CLI tools
Upload your snapshot that you’ve just downloaded using the following command, replacing
After the upload of your image snapshot is complete, you should see your snapshot in the list
Step 4: Boot your snapshot in the new cloud
The Snapshot has a minimum of required disk and RAM, so be sure to use a flavor that is the same or a bit bigger than the one you used before. Even though the snapshot image can be small in size, the image needs at least the allocated disk space and RAM of the original instance.
We will need to specify a couple of thing like our, flavor, network, security group, and key pair that we want to use. You can look it up using the following commands:
Check the list of available flavors using the following command:
Check your available networks
Your security groups
Your key pairs
Now for launching your instance we can use the following command:
You can check the status of your newly launched server
You now learned how you can download and upload instances using snapshots and launch the instance into a different OpenStack cloud provider by using the CLI tools.
TIP: After you have taken a snapshot of your instance you can turn the instance back on so that your application is still available. When your snapshot is running in the other cloud, you could then create a temporary database freeze, make a DB dump and restore it to the new instance. Change your DNS to the new IP and your good to go. This way the amount of downtime can be reduced by quite a bit.