Finally the help of IT is here

Blog of computer solutions.

Migrating virtual server to the Cloud with Amazon AWS

Written by Xaus Xavier Nadal on May 17th, 2014

Save pagePDF pageemail pagePrint page

Conduct a converter of a virtual machine from physical to virtual or virtual to virtual is a breeze with VMware Converter, as we have talked about it in other articlesBut now that many of you are making the move to the Cloud we show you other techniques to migrate virtual server to the Cloud and vice versa, from the cloud to your on premise environments.

But not all operating systems can be migrated and meet some prerequisites that we will see in the following link: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/VMImportPrerequisites.html

In this post we will show you how to migrate a server in a virtual infrastructure (On premise) that is in our infrastructure to a cloud environment (the cloud that we have chosen is Amazon as we quite like and some had to go). When we have much experience on Amazon see other options such as Azure or re-environments on premise and surely we will stay with Amazon, but it will be time and money will tell you definitively what environment is that we pay for and maintain (What to think of everything, air conditioners, cpd, painting, cleaning, light ...), the server will be migrated into a virtual environment based on VMware but also served with Citrix or Microsoft Hyper-V.

The benefits they currently have cloud environments like Amazon are paid for months and use, if you have a server off not pay for it (Well, .. more or less (keep in mind the Elastic IP, disks EBS, snapshots in S3, VPC, ....) Now I will explain later how these products work or while skipping asking with comments or via e you'll solved your doubts. Another of the benefits of these systems Cloud is that they are highly scalable, if we need more resources only expand the server is already in minutes have more CPU, more RAM, more disk even SSDs, or even more IOPS on a specific disk, if for example we want to set up a system of video streaming or game Mobile (app) and do not know how many users are going to have in the system and can not preveerlo may use methods like Auto-Scaling to start instances EC2 (Servers) of the same features that make Load Balancing between them and have unlimited resources to provide our customers the desired service, but best of all is that when customers stop using the application, game, or stop viewing the soccer match streaming these servers will go by turning off / removing and cost of the product will be only used.

But enough of both text and what we've really come to do.

 

Migrating to Amazon AWS server.

The first thing we will do is download the tools command line for Windows to work with Amazon AWS EC2 here also we can find for Linux and MacThe part of Windows already talked about it in the article where we explain as stop and start instances on Amazon EC2, But I'm going back to the steps to put the article is a step by step as I know you like.

1.- Download client EC2: http://aws.amazon.com/developertools/351

Now let's define the environment variable JAVA_HOME with the following process:

Click on Home -> Right click on computer and click on Properties

Click on Advanced System Settings.

Click on Environment Variables

In section System Variables click on News.

Variable name: JAVA_HOME

Variable value: C: \ Program Files \ Java \ jre7

Click on OK to validate.

Now let's define the environment variable EC2_HOME with the same process above:

Click on Home -> Right click on computer and click on Properties

Click on Advanced System Settings.

Click on Environment Variables

In section System Variables click on News.

Variable name: EC2_home

Variable value: "location EC2 client folder that you downloaded in the first point" for example C: \ AWS \ CLI

Click on OK to validate.

Now let's add the new route to Path

Get back to configurator management environment variables and system variables click on Path click on edit and we add % EC2_HOME% \ bin the value of the variable.

Click on OK to validate.

Now let's define the environment variable AWS_ACCESS_KEY y AWS_SECRET_KEY the same process that we used above for each time you execute a process does not have to be putting the key by hand.

First we know the keys from Amazon, follow the link below to find it out:https://console.aws.amazon.com/iam/home?#security_credential and acceded to Access Keys (Access Key ID and Secret Access Key)

Click on Home -> Right click on computer and click on Properties

Click on Advanced System Settings.

Click on Environment Variables

In section System Variables click on News.

Variable name: AWS_ACCESS_KEY

Variable value: <Access Key ID of your connection>

In section System Variables click on News.

Variable name: AWS_SECRET_KEY

Variable value: <Secret Access Key of your connection>

Click on To accept.

If we want to make sure the system is working properly and have followed step by step the points thanks to this command should

ec2-describe-regions

see similar to the following:

REGION us-east-1 ec2.us-east-1.amazonaws.com
REGION eu-west-sa-REGION ec1.eu-west-2.amazonaws.com 1-1 ec2.sa-east-1.amazonaws.com REGION east-northeast-ap-northeast ec1.ap 2-1.amazonaws. com REGION west-us-us-REGION ec2.us-west-2.amazonaws.com 2-1 west ec2.us-west-1.amazonaws.com ap-southeast REGION-1 ec2.ap-southeast-1.amazonaws .com

The default region or when we migrate them up or do any action from the CLI will east1 us-and if we create such EC2 (Server) instance in Europe (Ireland) we modify the region eu-west1 with switch-region eu -west-1 or creating an environment variable called EC2_URL with the following value: https://ec2.eu-west-1.amazonaws.com as we have done in the previous steps.

Currently as of this post Amazon AWS does not support the migration of servers with more than one virtual disk with the command ec2-import-instance and for this we use the command ec2-import-volume atacharemos then the EBS volume to the instance EC2 we have imported.

I leave a link where the prior preparation of the virtual machine is shown to migrate http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/PreparingYourVirtualMachine.htmlBut these are the key points.

The virtual server should preferably have an IP by DHCP or we ensure that when we go to Amazon to make the export destination IP is available on the VPC to access this instance EC2 remotely without problems.

 

We should also turn off any antivirus and firewall and IPS you have installed on the server to migrate.

 

Disconnect any cd CD-ROM drive assigned to the virtual machine

 

Turn off the server we are going to migrate

There is another method to migrate the virtual machine to Amazon I leave it here for you to consider (do not need to do any of the processes mentioned up to this point, is more intuitive, but it has its cons).

VM Import EC2 Connector by installing a VirtualApp downloaded from Amazon but if the virtual server you want to migrate to AWS has assigned more than one virtual disk we see the following error: "This VM Been More Than One Disk. Can not Export. "And we can not migrate server, but everything has a solution as we deallocate the additional virtual disks on the server and retry the export to Amazon AWS or follow the process as we are doing in this article.

Here we go.

Now we perform the export of the virtual machine to OVF export by, but I leave a link so you can see how to do to Citrix and / or Hyper-V as well; http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ExportingYourVM.html thus when we make the disk migration. vmdk not be compressed and transferred over the network we all space used by the vmdk or similar..

We access our virtual Center, select the server you want to migrate to Amazon and click on Fillet -> export -> Export OVF Template ...

Export-vmdk-to-Amazon_thumb

We left scored the OVF format (Since this way if we have more of a drive and we we'll have to use a separate command for each disk type).

Export VM to AWS

Click on OK and start the process, if you have more than one disk we see that in the progress screen puts exporting item 1 / 2 2 eg if you have disks.

Export VM to Amazon AWS

When the export is finished, We can start the server, but think that all the changes we make to it will not be migrated to the Amazon environment. Perhaps in the future there is a process to perform an incremental migration of changes made after the first migration. See if someone from Amazon hears and implemented.

Meanwhile we will create a Bucket in S3 if we have not already set up to send the virtual disk to S3 later converitrlo EC2 pending.

We access our Amazon AWS environment and access the S3 service.

Create Bucket on Amazon S3

click on Create Bucket

Create a Bucket in S3

We wrote a descriptive name and click on the bucket Create. (All lowercase)

Now we have our repository S3 created and ready to use.

Access the command line ready to export the virtual machine to the Amazon environment

You can import some things must be clear. Region where the instance will be located with the switch -Region eu-west-1 I'll Ireland.

Knowing that we will assign VPC if we had several with the modifier -subnet subnet_id me for example I like to have several created in Amazon VPC (Development Environment, Environment Domain, Environment Test) VPC 3 get these servers are not together unless Peering VPC and then you can for example, one having a VPN against external delegation Amazon.

Knowing the type of instance you want to migrate to our server (You can see the comparison chart on the following link:

EC2 instance naming http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html

Defining instances EC2 http://aws.amazon.com/es/ec2/instance-types/

Prices per instance type EC2 http://aws.amazon.com/es/ec2/pricing/

Although I always migrated all servers type instances t1.micro so that the costs are minimized during the migration phase and tuning (think we still will migrate additional records, check that everything works properly, set the fixed IP, etc. ..)

Discussed above we will import the EC2 instance with the following command Amazon ec2-import-instance if you pulsáis in you will see all available options.

ec2-import-instance DISK_IMAGE_FILENAME -t InstanceType -f FORMAT -a -SYSTEM ARCHITECTURE -b S3_BUCKET_NAME -o OWNER -w SecretKey -p PLATFORM_NAME

In our case we are going to migrate a VMware virtual machine 32 bit we're going to do with a Micro instance type for cost savings the command we use is:

ec2-import-instance TEST2-disk1.vmdk -Region eu-west-1 -t t1.micro -f VMDK -a i386 -B migracionvmtoaws-O %% AWS_ACCESS_KEY -W %% AWS_SECRET_KEY

The estimated migration time depends on the bandwidth that you have, the more the better because remember that the server is turned off or if you have at least started, remember that changes made by users will not be in the migrated system.

AWS migration from VMDK

If we agree while the process takes place in our Bucket S3 see that the files are created.

Bucket S3 importing VM from VMDK

Migrate VM to EC2

If for some reason the migration is interrupted, with the following command we could resume it again.

ec2-resume-import

When the import is complete and we can start the ec2 instance and delete temporary s3 data using the following command or from the service by accessing the Bucket EC2 created:

ec2-delete-disk-image

If the virtual server has 2 or more disks we use the following command:

c2-import-volume disk_image -f file_format -z availability_zone -b s3_bucket_name -o ACCESS_KEY -w secret_key

And then atachar EBS discs to EC2 instance.

What I always do and I recommend to my clients is to name each disc (EBS) with the name of SERVER_C y _D as if it were units, like every EC2 instance I put a server name as Server0001 - <Description>At Amazon is very easy to create servers but if you have a routine of creation and an established nomenclature can become very messy leading to confusion and can get to remove disks or servers even you thought were different.

If you have any questions please let a comment or send me an email and I'll try to help as much as I can.

Indeed, if in the migration process have done some testing and I have been half the processes, look at the following article to solve the problems (It has been created instance me and I can not delete, can not finish an instance , ...)http://www.megacrack.es/2014/05/18/como-cancelar-tareas-de-importacion-en-amazon-aws/

Greetings and see you soon.

Related Posts Plugin for WordPress, Blogger ...
Tags: , , , , ,


One Response to "Migrate virtual server to the Cloud with Amazon AWS"

  1. CHRISTIAN GALLEGOS Says:

    Hello, I need to migrate my web services Amazon budget can give me please.

Leave a Reply

XHTML: You can use in Original tags: <a href="" title=""> <abbr title = ""> <acronym title = ""> <b> <blockquote cite = ""> <cite> <code> <del datetime = ""> <em> <i> <q cite = ""> <s> <strike> <strong>