Check if an EC2 instance could be exported

0

Hi all,

I know how to export an EC2 instance with create-instance-export-task, but I'm trying to find a way to check if a certain instance would be exportable without actually starting the export if it is.

Background: AWS docs say

You can't export an instance if it contains third-party software provided by AWS. For example, VM Export cannot export Windows or SQL Server instances, or any instance created from an image in the AWS Marketplace.

I have a pretty long list of IDs for EC2 instances and need to find out which of them can or can't be exported, so what I'm looking for is basically some kind of

aws ec2 create-instance-export-task --dry-run --instance-id ...

but I'd be happy with any kind of shell command that tells me "yes, this one can be exported" or "no, this one can't be exported".

Is there any way to do this, or do I have to start an export for every instance, then check the status and cancel it if it's actually running?

Thanks,

Marc

已提问 10 个月前289 查看次数
1 回答
0

Hi Abhinav,

thanks for your reply. What you describe is what I was hoping for, but it seems it doesn't work like this.

The documentation doesn't list a --instance-id parameter and if I try it, the reply is Unknown options: --instance-id.

The create-instance-export-task actually kind of works, because it will terminate with an error description for instances that can't be exported (marketplace AMI, more than one volume etc.). This is useful because these checks seem to run before the check if the instance is currently running, so it can be used on active instances. The command is

aws ec2 create-instance-export-task --description "test export" \
 --instance-id i-012345... \
 --target-environment vmware \
 --export-to-s3-task DiskImageFormat=vmdk,ContainerFormat=ova,S3Bucket=yourtestbucket

where the bucket exists and has permissions according to the documentation.

Note that this will create the export task if the machine is exportable and currently stopped, I couldn't find a way around that. Since I now found out that almost none of the instances are exportable, because they were created from a marketplace AMI, I need to find a different solution anyway.

Cheers,

Marc

已回答 10 个月前
profile picture
专家
已审核 7 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则