啟動匯出映像作業 - VM Import/Export

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

啟動匯出映像作業

當您使用 VM Import/Export 匯出映像時,匯出的檔案會使用下列 S3 金鑰寫入指定的 S3 儲存貯體:

prefixexport-ami-xxxxxxxxxxxxxxxxx.format

例如,如果儲存貯體名稱為 amzn-s3-demo-export-bucket,字首為 exports/,格式為 VMDK,則匯出的影像會寫入 amzn-s3-demo-export-bucket/exports/export-ami-1234567890abcdef0.vmdk

如需有關支援格式的資訊,請參閱 匯出映像的考量事項

AWS CLI
匯出映像

使用 export-image 命令。

aws ec2 export-image \ --description "$(date '+%b %d %H:%M') My image export" \ --image-id ami-1234567890abcdef0 \ --disk-image-format VMDK \ --s3-export-location S3Bucket=amzn-s3-demo-export-bucket,S3Prefix=exports/

下列為範例輸出。

{ "Description": "Jul 15 16:31 My image export", "DiskImageFormat": "VMDK", "ExportImageTaskId": "export-ami-36a041c1000000000", "ImageId": "ami-1234567890abcdef0", "Progress": "0", "S3ExportLocation": { "S3Bucket": "amzn-s3-demo-export-bucket", "S3Prefix": "exports/" }, "Status": "active", "StatusMessage": "validating" }
PowerShell
匯出映像

使用 Export-EC2Image cmdlet。

Export-EC2Image ` -Description ((Get-Date -Format "MMM dd HH:mm ") + "My image export") ` -ImageId ami-1234567890abcdef0 ` -DiskImageFormat VMDK ` -S3ExportLocation_S3Bucket amzn-s3-demo-export-bucket ` -S3ExportLocation_S3Prefix exports/

下列為範例輸出。

Description : Jul 15 16:35 My image export DiskImageFormat : VMDK ExportImageTaskId : export-ami-36a041c1000000000 ImageId : ami-1234567890abcdef0 Progress : 0 RoleName : S3ExportLocation : Amazon.EC2.Model.ExportTaskS3Location Status : active StatusMessage : validating Tags : {}