Import virtual machines from VMware ESX to AWS

Step 0, Option 1: Create AWS keys
Info: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html#cli-signup
 
Step 0, option 2
– Create AWS user account with full access
– Create configuration file: https://amp.aws.amazon.com/VCPlugin.html#setup_selection
– Create a service user account in vCenter:
– Optional: Download and  install AWS Connector for vCenter: https://aws.amazon.com/ec2/vcenter-portal
 
Procedures for Option 1:
 
Step 1: Install AWS CLI (http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-msi-on-windows)
Download AWS CLI Tools: http://aws.amazon.com/developertools/351
 
Step 2: Install Java and set Paths
Source: http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/set-up-ec2-cli-windows.html
 
Step 3: Configure CLI
Source: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UsingVirtualMachinesinAmazonEC2.html
#aws configure
Access Key ID: $accessKey=”xxxxxZFFRVSU45E7xxxxx”
Secret Access Key: $secretAccessKey=”xxxxxAQP9hUzTHJDthDkKC25whquP6cB9Bgxxxxx”
Default Region: us-west-1
Default output format [None]: json
 
Step 4: Prepare VM
Disable antivirus
Make sure volumes are MBR as GPT is not supported
P2V converted VMs are not supported
Disk cannot exceed 1TB
 
Step 5: Export VM
http://pubs.vmware.com/vsphere-4-esx-vcenter/index.jsp?topic=/com.vmware.vsphere.vmadmin.doc_41/vc_client_help/importing_and_exporting_virtual_appliances/t_export_a_virtual_machine.html
vSphere client >> Select VM >> File >> Export >> Export OVF Template >> Enter information >> Choose OVF format
 
Step 6: Import into AWS EC2
Example of VM with two volumes (C:\ and D:\)
# ec2-import-instance C:\Users\kdoan\Desktop\MAIL03\MAIL03-disk1.vmdk -f VMDK -z us-west-1b -t t2.large -a x86_64 -b s3n.cal -o xxxxxZFFRVSU45E7xxxxx -w xxxxxAQP9hUzTHJDthDkKC25whquP6cB9Bgxxxxx -p Windows –subnet subnet-8e1a28c8
# ec2-import-volume C:\Users\kdoan\Desktop\MAIL03\MAIL03-disk2.vmdk -f VMDK -z us-west-1b -s 100 -b s3n.cal -o xxxxxZFFRVSU45E7xxxxx -w xxxxxAQP9hUzTHJDthDkKC25whquP6cB9Bgxxxxx
 
Run the instance and attach the volume(s)
Run sysprep
 
Optional:
 
Cleanup:
ec2-delete-disk-image -t import-i-ffj3s15y -o xxxxxZFFRVSU45E7xxxxx-w xxxxxAQP9hUzTHJDthDkKC25whquP6cB9Bgxxxxx
 
 
Example importing machine with three volumes:
# ec2-import-instance C:\Users\kdoan\Desktop\POLICY01\POLICY01-disk1.vmdk -f VMDK -z us-west-1b -t t2.large -a x86_64 -b s3n.cal -o $accessKey -w $secretAccessKey -p Windows –subnet subnet-8e1a28c8
# ec2-import-volume C:\Users\kdoan\Desktop\POLICY01\POLICY01-disk2.vmdk -f VMDK -z us-west-1b -s 50 -b s3n.cal -o $accessKey -w $secretAccessKey
# ec2-import-volume C:\Users\kdoan\Desktop\POLICY01\POLICY01-disk3.vmdk -f VMDK -z us-west-1b -s 250 -b s3n.cal -o $accessKey -w $secretAccessKey
 
Other Examples:
# ec2-import-instance C:\Users\kdoan\Desktop\WEB01\WEB01-disk1.vmdk -f VMDK -z us-west-1c -t t2.large -a x86_64 -b s3n.cal -o $accessKey -w $secretAccessKey -p Windows –subnet subnet-28798a4d
# ec2-import-volume C:\Users\kdoan\Desktop\WEB01\WEB01-disk2.vmdk -f VMDK -z us-west-1c -s 100 -b s3n.cal -o $accessKey -w $secretAccessKey
 
# ec2-import-instance C:\Users\kdoan\Desktop\Export\FTP01\FTP01-disk1.vmdk -f VMDK -z us-west-1c -t t2.medium -a x86_64 -b s3n.cal -o $accessKey -w $secretAccessKey -p Windows –subnet subnet-28798a4d
# ec2-import-volume C:\Users\kdoan\Desktop\Export\FTP01\FTP01-disk2.vmdk -f VMDK -z us-west-1c -s 100 -b s3n.cal -o $accessKey -w $secretAccessKey
 
# ec2-import-instance C:\Users\kdoan\Desktop\Export\CLAIMS01\CLAIMS01-disk1.vmdk -f VMDK -z us-west-1b -t t2.medium -a x86_64 -b s3n.cal -o $accessKey -w $secretAccessKey -p Windows –subnet subnet-8e1a28c8
# ec2-import-volume C:\Users\kdoan\Desktop\export\CLAIMS01\CLAIMS01-disk2.vmdk -f VMDK -z us-west-1b -s 100 -b s3n.cal -o $accessKey-w $secretAccessKey
 
# ec2-import-instance C:\Users\kdoan\Desktop\Export\POLICY01\POLICY01-disk1.vmdk -f VMDK -z us-west-1b -t t2.medium -a x86_64 -b s3n.cal -o $secretAccessKey -w $accessKey -p Windows –subnet subnet-8e1a28c8
# ec2-import-volume C:\Users\kdoan\Desktop\export\POLICY01\POLICY01-disk2.vmdk -f VMDK -z us-west-1b -s 50 -b s3n.cal -o $accessKey -w $secretAccessKey
# ec2-import-volume C:\Users\kdoan\Desktop\export\POLICY01\POLICY01-disk3.vmdk -f VMDK -z us-west-1b -s 250 -b s3n.cal -o $accessKey -w $secretAccessKey
 
# ec2-import-instance C:\Users\kdoan\Desktop\Export\UND01\UND01-disk1.vmdk -f VMDK -z us-west-1b -t t2.medium -a x86_64 -b s3n.cal -o $accessKey -w $secretAccessKey -p Windows –subnet subnet-8e1a28c8
# ec2-import-volume C:\Users\kdoan\Desktop\export\UND01\UND01-disk2.vmdk -f VMDK -z us-west-1b -s 120 -b s3n.cal -o $accessKey -w $secretAccessKey

Leave a Reply

Your email address will not be published. Required fields are marked *