You can migrate an existing Classic virtual server instance to VPC by capturing an image of the Classic virtual server instance and importing it in VPC Gen 1 or VPC Gen 2.
The migration steps are:
- Capture an image of a classic VSI.
- Export the image to Cloud Object Storage.
- Import this image into VPC custom image list.
- Provision a VSI from this image.
The scripts in this folder show an example to migrate a CentOS VSI running in the Classic Infrastructure to a VSI running in VPC (Gen 1 or Gen 2). The scripts automate all steps you would find while going through the documentation:
- Create a Cloud Object Storage instance and a bucket to store the captured image.
- Set up an authorization between Cloud Object Storage and the VPC Image service.
- Create a VSI in the Classic Infrastructure.
- Install Nginx on the VSI so that later we can verify the new VSI also runs Nginx.
- Capture the VSI image and wait for the image to be ready.
- Copy the image to Cloud Object Storage.
- Import the image into the VPC Custom Image list once the image is ready in Cloud Object Storage.
- Provision a new VSI in VPC from this image.
The scripts do not check permissions. You must ensure you have the right permissions:
- to create Classic virtual server instances with public network,
- to capture Classic instance images,
- to create Cloud Object Storage instance,
- to create VPC, subnets, servers
-
Copy the configuration file and set the values to match your environment.
cp template.local.env local.env
-
Load the values into the current shell.
source local.env
-
Ensure you have the prerequisites to run the scripts.
./000-prereqs.sh
-
Create a Cloud Object Storage instance to capture the Classic instance image and to copy it to VPC.
./010-prepare-cos.sh
-
Create a Classic virtual server instance.
./020-create-classic-vm.sh
The script installs Nginx on this instance. It will test that the virtual server instance is accessible through its public address and retrieve the Nginx home page.
-
Capture an image of the Classic virtual server instance.
./030-capture-classic-to-cos.sh
-
Import the captured image into VPC.
./040-import-image-to-vpc.sh
-
Create a VPC and a virtual server instance from the image.
./050-provision-vpc-vsi.sh
The script will test that the virtual server instance is accessible through its public address and retrieve the Nginx home page to confirm the migration worked as expected.
To delete the Classic VSI, the Cloud Object Storage instance, the images, the VPC, run:
./060-cleanup.sh