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

Marc
asked 4 months ago152 views
1 Answer
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

Marc
answered 4 months ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions