In the April 2013 release of Skytap Cloud, we announced the availability of the public beta Skytap Cloud command line interface (CLI). Documentation for the Skytap Cloud CLI is installed along with the Skytap Cloud CLI itself, but I’ll run through the basics and offer a few tips in this blog post.
Using the CLI to Copy VMs from One Region to Another
Aside from the obvious use of the command line interface to automate Skytap Cloud processes or to integrate the Skytap Cloud into existing build, development, deploy, and test procedures, the CLI also automates the multi-step process of copying virtual machines from one Skytap region to another. This is useful if you have a requirement to use the same virtual machine in the US-West region and in the US-East region. The specific CLI command to accomplish the automated copy is as follows: skytap vm copytoregion [US-East | US-West] [VM-ID]
This single command automates the following multi-step process:
- Export the virtual machine specified by the VM-ID.
- Download to the machine on which the command was executed; the compressed archive that resulted from the Skytap export operation.
- Upload that compressed archive to a Skytap ftp account in the region specified in the command line.
- Import the virtual machine into the user’s account in the specified region.
To accomplish these operations, your Skytap account must be enabled for the following capabilities:
The ability to access multiple Skytap regions.
You can see if your account is enabled for multi-region access by navigating to the Public Templates section of the Skytap Public Templates page. If you can see public templates in both the US-West and US-East regions, your account has multi-region access.
Permission to import and export virtual machines.
All administrators already have this permission, but it can also be given to other user accounts. You have permission if you have “Import” and “Export” buttons in the top level Skytap Cloud Navigation bar.
(For a thorough discussion of the exporting and importing process that this command automates, see the Importing and Exporting Virtual Machines document.)
Rules of the Road
Here are some rules that govern using the “skytap vm copytoregion …” command:
- You are required to authenticate with Skytap Cloud. To do this you will need to know your username (which ought not to be a problem) and your API Security Token. If you haven’t used it before, your API Security Token is available in the “Your Account” section of the Skytap Web.
- You can’t copy VMs directly from templates in the Skytap Public Template library. If you try, here is what you’ll see:
- VMs can only be copied from template definitions, the can not be copied from configurations. If you try, you’ll see the same error message as in the above screen-shot.
- The disk containing the folder or directory from which you issue the “skytap vm copytoregion …” command must have enough space to hold the compressed archive that is generated as part of the export process.
- Once you issue the “skytap vm copytoregion …” command, it starts background processes to do the export, copy and import operations. Even if you interrupt or terminate the “skytap vm copytoregion …” command, these background processes will continue to run until they finish their job.
Using the Skytap High-Speed Network to Copy VMs
While exporting and importing virtual machines is a time consuming process, the process to copy a virtual machine from one Skytap region to another is made even more time consuming by the required download and upload operations. Operating over a public Internet connection, these download and upload times can be onerous. For this reason, we’ve created a template in the Skytap Public Template library that has the CLI pre-installed.
By using this public template to create a configuration containing the CLI virtual machine, you can make use of Skytap’s high-speed internal network to speed up the download and upload operations required by the VM import/export process.
Below is a screenshot taken of the CLI virtual machine being used to transfer a VM named “CentOS 5.6 (32-bit)” from the US-West region to the US-East region:
The lines indicating the image is “Exporting” are repeated about every 15 seconds. After the export is complete, you will see status messages indicating the progress of the download operation.
Likewise, when the download operation is complete the upload operation begins:
The final operation is the import of the VM:
When the entire process is complete the command terminates:
Additionally, you will receive an email indicating that the “skytap vm copytoregion …” command completed:
If you now navigate to your personal template library, you should see your imported VM in a template of the same name:
Other Uses for the Skytap Command Line Interface VM
In addition to using the Skytap Command Line Interface VM to transfer virtual machines between regions, you can also use it to try out the CLI before installing it in your local environment. Additionally, if your organization will not allow the CLI to be installed on your work computer, you can use the CLI VM to automate Skytap Cloud operations and processes.
If you would like more information on the Skytap Command Line Interface Public Template, please review the following resources:
As always, Skytap support is available to help you if you have any issues with the Skytap Cloud Command Line Interface or the CLI VM.