将 Windows VM 从 Amazon Web Services (AWS) 移到 Azure 虚拟机Move a Windows VM from Amazon Web Services (AWS) to an Azure virtual machine

如果你正在评估是否要使用 Azure 虚拟机托管工作负荷,可以导出现有的 Amazon Web Services (AWS) EC2 Windows VM 实例,然后将虚拟硬盘 (VHD) 上传到 Azure。If you are evaluating Azure virtual machines for hosting your workloads, you can export an existing Amazon Web Services (AWS) EC2 Windows VM instance then upload the virtual hard disk (VHD) to Azure. 上传 VHD 后,可以通过该 VHD 在 Azure 中创建新的 VM。Once the VHD is uploaded, you can create a new VM in Azure from the VHD.

本文介绍如何将单个 VM 从 AWS 移至 Azure。This article covers moving a single VM from AWS to Azure. 如果想要将 VM 从 AWS 批量迁移到 Azure,请参阅使用 Azure Site Recovery 将 Amazon Web Services (AWS) 中的虚拟机迁移到 AzureIf you want to move VMs from AWS to Azure at scale, see Migrate virtual machines in Amazon Web Services (AWS) to Azure with Azure Site Recovery.

准备 VMPrepare the VM

可以将通用和专用 VHD 上传到 Azure。You can upload both generalized and specialized VHDs to Azure. 每种类型都需要在从 AWS 导出之前准备 VM。Each type requires that you prepare the VM before exporting from AWS.

  • 通用 VHD - 通用 VHD 包含使用 Sysprep 删除所有个人帐户信息。Generalized VHD - a generalized VHD has had all of your personal account information removed using Sysprep. 如果想要使用 VHD 作为映像来创建新的 VM,应该:If you intend to use the VHD as an image to create new VMs from, you should:

  • 专用 VHD - 专用 VHD 保留原始 VM 中的用户帐户、应用程序和其他状态数据。Specialized VHD - a specialized VHD maintains the user accounts, applications and other state data from your original VM. 如果想要使用当前 VHD 创建新 VM,请确保完成以下步骤。If you intend to use the VHD as-is to create a new VM, ensure the following steps are completed.

    • 准备好要上传到 Azure 的 Windows VHDPrepare a Windows VHD to upload to Azure. 不要使用 Sysprep 通用化 VM。Do not generalize the VM using Sysprep.
    • 删除 VM 上安装的所有来宾虚拟化工具和代理(例如 VMware 工具)。Remove any guest virtualization tools and agents that are installed on the VM (i.e. VMware tools).
    • 确保 VM 配置为通过 DHCP 来提取其 IP 地址和 DNS 设置。Ensure the VM is configured to pull its IP address and DNS settings via DHCP. 这确保服务器在启动时在 VNet 中获取 IP 地址。This ensures that the server obtains an IP address within the VNet when it starts up.

导出和下载 VHDExport and download the VHD

将 EC2 实例导出到 Amazon S3 存储桶中的 VHD。Export the EC2 instance to a VHD in an Amazon S3 bucket. 执行 Amazon 文档使用 VM导入/导出功能导出实例作为 VM 中所述的步骤,然后运行 create-instance-export-task 命令将 EC2 实例导出到 VHD 文件。Follow the steps in the Amazon documentation article Exporting an Instance as a VM Using VM Import/Export and run the create-instance-export-task command to export the EC2 instance to a VHD file.

导出的 VHD 文件将保存在指定的 Amazon S3 存储桶中。The exported VHD file is saved in the Amazon S3 bucket you specify. 导出 VHD 的基本语法如下所示,只需将 <brackets> 中的占位符文本替换为自己的信息。The basic syntax for exporting the VHD is below, just replace the placeholder text in <brackets> with your information.

aws ec2 create-instance-export-task --instance-id <instanceID> --target-environment microsoft \
  --export-to-s3-task DiskImageFormat=VHD,ContainerFormat=ova,S3Bucket=<bucket>,S3Prefix=<prefix>

导出 VHD 后,按照如何从 S3 存储桶下载对象?中的说明从 S3 存储桶下载 VHD 文件。Once the VHD has been exported, follow the instructions in How Do I Download an Object from an S3 Bucket? to download the VHD file from the S3 bucket.

重要

AWS 会收取下载 VHD 所产生的数据传输费用。AWS charges data transfer fees for downloading the VHD. 有关详细信息,请参阅 Amazon S3 定价See Amazon S3 Pricing for more information.

后续步骤Next steps

现在,可将 VHD 上传到 Azure 并创建新的 VM。Now you can upload the VHD to Azure and create a new VM.