「翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。」
Importing a VM as an Image Using VM Import/Export
VM Import/Export を使用して、仮想化環境から Amazon EC2 に仮想マシン (VM) イメージを、インスタンスの起動に使用できる Amazon Machine Image (AMI) としてインポートできます。その VM イメージは、後でインスタンスから仮想化環境にエクスポートできます。これにより、Amazon EC2 に移行されるため、IT セキュリティ、構成管理、およびコンプライアンス要件に合わせて作成した VM への投資が無駄になりません。
目次
Export Your VM from its Virtualization Environment
VM をエクスポートする準備ができたら、それを仮想化環境からエクスポートできます。VMをイメージとしてインポートすると、次の形式でディスクをインポートできます。OVA(Open Virtualization Archive)、VMDK(Virtual Machine Disk)、VHD/VHDX(Virtual Hard Disk)、raw。仮想化環境によっては、通常 1 つ以上の VMDK、VHD、または VHDX ファイルを含む Open Virtualization Format (OVF) にエクスポートした後、ファイルを OVA ファイルにパッケージ化することになります。
詳細については、「仮想化環境」のドキュメントを参照してください。たとえば、 と指定します。
-
VMware — Search for "Export an OVF Template" on the VMware Docs
site. Follow the instructions for creating an OVA. -
Citrix — About VM Import and Export
on the Citrix website -
Microsoft Hyper-V — Overview of exporting and importing a virtual machine
on the Microsoft website -
Microsoft Azure — Download a Windows VHD from Azure
or Download a Linux VHD from Azure on the Microsoft website. From the Azure Portal, choose the VM to migrate, and then choose Disks. Select each disk (either OS or data) and choose Create Snapshot. On the completed snapshot resource, choose Export. This creates a URL that you can use to download the virtual image.
Import Your VM as an Image
VM を仮想化環境からエクスポートした後に、Amazon EC2 にインポートできます。インポートプロセスは、VMの原点に関係なく同じです。
Prerequisites
-
Create an Amazon S3 bucket for storing the exported images or choose an existing bucket. The bucket must be in the Region where you want to import your VMs. For more information about S3 buckets, see the Amazon Simple Storage Service コンソールユーザーガイド.
-
Create an IAM role named
vmimport
. For more information, see 必要なサービスロール. -
If you have not already installed the AWS CLI on the computer you'll use to run the import commands, see the AWS Command Line Interface ユーザーガイド.
Upload the Image to Amazon S3
任意のアップロードツールを使用して、Amazon S3 バケットに VM イメージファイルをアップロードします。Amazon S3 コンソールからオブジェクトをアップロードする方法については、「オブジェクトのアップロード」を参照してください。
Import the VM
Amazon S3 に VM イメージファイルをアップロードした後、AWS CLI を使用してイメージをインポートできます。これらのツールは、Amazon S3 バケットおよびファイルへのパス、またはパブリック Amazon S3 ファイルの URL のいずれかを受け取ります。プライベート Amazon S3 ファイルには署名付き URL が必要です。
次の例では、AWS CLI コマンド import-image を使用してインポートタスクを作成します。
例 1 OVA のインポート
次のコマンドを使用して、1 つのディスクでイメージをインポートします。
aws ec2 import-image --description "
My server VM
" --disk-containers "file://C:\import\containers.json
"
以下に示しているのは、containers.json
ファイルの例です。
[ { "Description": "My Server OVA", "Format": "ova", "UserBucket": { "S3Bucket": "my-import-bucket", "S3Key": "vms/my-server-vm.ova" } }]
例 2 複数のディスクのインポート
複数のディスクを含むイメージをインポートするには、以下のコマンドを使用します。
$
C:\>
aws ec2 import-image --description "
My server disks
" --disk-containers "file://C:\import\containers.json
"
以下に示しているのは、containers.json
ファイルの例です。
[ { "Description": "First disk", "Format": "vmdk", "UserBucket": { "S3Bucket": "my-import-bucket", "S3Key": "disks/my-server-vm-disk1.vmdk" } }, { "Description": "Second disk", "Format": "vmdk", "UserBucket": { "S3Bucket": "my-import-bucket", "S3Key": "disks/my-server-vm-disk2.vmdk" } } ]
例 3 暗号化オプションを有効にしてディスクをインポート
暗号化されたルートボリュームを持つイメージをインポートするには、次のコマンドを使用します。
aws ec2 import-image --description "
My server disks
" --encrypted --kms-key-id0ea3fef3-80a7-4778-9d8c-1c0c6EXAMPLE
--disk-containers "file://C:\import\containers.json
"
暗号化用に指定された CMK をインポートプロセス全体で無効にすることはできません。詳細については、以下を参照してください。 Amazon EBS暗号化 の Amazon EC2 User Guide.
Monitor an Import Image Task
describe-import-image-tasks コマンドを使用して、インポートタスクのステータスを返します。
aws ec2 describe-import-image-tasks --import-task-ids import-ami-
1234567890abcdef0
次のようなステータス値があります。
-
active
— The import task is in progress. -
deleting
— The import task is being canceled. -
deleted
— The import task is canceled. -
updating
— Import status is updating. -
validating
— The imported image is being validated. -
validated
— The imported image was validated. -
converting
— The imported image is being converted into an AMI. -
completed
— The import task is completed and the AMI is ready to use.
画像のインポートタスクが完了すると、出力にはAMIのIDが含まれます。次は、 ImageId
.
{ "ImportImageTasks": [ { "ImportTaskId": "import-ami-01234567890abcdef", "ImageId": "ami-1234567890EXAMPLE", "SnapshotDetails": [ { "DiskImageSize": 705638400.0, "Format": "ova", "SnapshotId": "snap-111222333444aaabb" "Status": "completed", "UserBucket": { "S3Bucket": "my-import-bucket", "S3Key": "vms/my-server-vm.ova" } } ], "Status": "completed" } ] }
Cancel an Import Image Task
アクティブなインポートタスクをキャンセルする必要がある場合は、 キャンセル-インポート-タスク コマンド。
aws ec2 cancel-import-task --import-task-id import-ami-
1234567890abcdef0
Next Steps
イメージのインポート タスクが完了したら、結果のAMIを使用してインスタンスを起動するか、AMIを別の地域にコピーできます。
Windows
一部のオペレーティングシステムでは、Nitro ベースのインスタンスに必要な拡張ネットワーキングおよび NVMe ブロックデバイス用のデバイスドライバは、インポート中に自動的にインストールされません。これらのドライバを手動でインストールするには、次のドキュメントの指示に従って行います。次に、カスタマイズされたインスタンスから新しい AMI を作成します。
Windows