Migrating from AWS to OpenStack

Not all of the VMs or workloads may be suitable to be run on the public cloud. Several organizations have decided to run their workloads in the local data center, so as to have more control over the resources, for better cost advantage, or for better performance. Hence, there is a need to migrate workloads from the public cloud to the private cloud.

The following diagram shows the steps involved in migrating an AWS EC2 instance to OpenStack:

You will need the following in order to migrate an EC2 instance from AWS to your OpenStack cloud platform:

  • AWS CLI installed
  • AWS S3 bucket 
  • EC2 instance to be migrated

The following steps must be performed to migrate an EC2 instance to OpenStack:

  1.  Create a new AWS EBS volume with a large size as per the EC2 instance disk:
aws ec2 create-volume –size 16 –region us-west-1 –availability-zone us-west-1b –volume-type gp2
  1. Attach the volume to the EC2 instance that you intend to migrate:  
 aws ec2 attach-volume –volume-id <volume id> –instance-id <instance id> –device /dev/sdb
  1. Partition the newly added disk as an ext4 filesystem:
mkfs.ext4 /dev/xvdf1
  1. Mount the disk to a folder of your choice:
mount /dev/xvdf1 /mnt/disk
  1. Using dd , copy the root disk of the EC2 instance to an image file on the new disk. This operation will take some time depending on the size of the disk:
dd if=/dev/xvda of=/mnt/disk/vm.img
  1. Copy the disk file to S3 using the following command (replace the bucket name with the name that you used):
aws s3 cp /mnt/disk/vm.img s3://packtpub-bucket/
  1. Copy the image from the S3 bucket to your local OpenStack image server:
aws s3 cp s3://packtpub-bucket/vm.img /tmp/image/
  1. Using the OpenStack glance client, import the AMI to the OpenStack environment:
glance image-create –disk-format raw –container-format bare –name packtpubAMI –file /tmp/image/vm.img –progress
  1. Once the image is imported into the glance image server, you can now launch the OpenStack VM using the image:
nova boot --flavor m1.tiny --image packtpubAMI --nic net-id=PRIVATE_NET_ID 
--security-group default --key-name packtpubkey testvm

Here PRIVATE_NET_ID is the ID of the network to be used for launching the instance.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.215.61