Step 0, Option 1: Create AWS keys
Info: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#cli-signup
Step 0, option 2
– Create AWS user account with full access
– Create configuration file:
– Create a service user account in vCenter:
– Optional: Download and install AWS Connector for vCenter: https://aws.amazon.com/ec2/
Procedures for Option 1:
Step 1: Install AWS CLI https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#install-msi-on-windows)
Download AWS CLI Tools: https://aws.amazon.com/developer/tools/
Step 2: Install Java and set Paths
Source:
Step 3: Configure CLI
Source: https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-instance-import.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
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
Categories: