aws / aws-sdk

Landing page for the AWS SDKs on GitHub
https://aws.amazon.com/tools/
Other
68 stars 13 forks source link

Cannot export an EC2 instance as RAW file #535

Closed aalcaraz97 closed 1 year ago

aalcaraz97 commented 1 year ago

Describe the bug

I have created an EC2 instance from a custom AMI. I want to export the instance in RAW format using the "aws ec2 create-instance-export-task" command. I have followed the documentation of the "aws ec2 create-instance-export-task" CLI command. These are the options that I have set:

However, when I have to set the value of the --target-environment flag (which can only be either "citrix", "vmware" or "microsoft", according to the CLI docs), all the possible values give me an error.

citrix error:

$ aws ec2 create-instance-export-task --instance-id <instance-id> --target-environment citrix --export-to-s3-task DiskImageFormat=RAW,S3Bucket=<my-s3-bucket>,S3Prefix=<my-s3-prefix>

An error occurred (Unsupported) when calling the CreateInstanceExportTask operation: diskImageFormat 'raw' not supported for targetEnvironment 'citrix'. Valid value(s): ["'vhd', .

microsoft error:

$ aws ec2 create-instance-export-task --instance-id <instance-id> --target-environment microsoft --export-to-s3-task DiskImageFormat=RAW,S3Bucket=<my-s3-bucket>,S3Prefix=<my-s3-prefix>

An error occurred (Unsupported) when calling the CreateInstanceExportTask operation: diskImageFormat 'raw' not supported for targetEnvironment 'microsoft'. Valid value(s): ["'vhd', .

vmware error:

$ aws ec2 create-instance-export-task --instance-id <instance-id> --target-environment vmware --export-to-s3-task DiskImageFormat=RAW,S3Bucket=<my-s3-bucket>,S3Prefix=<my-s3-prefix>

An error occurred (Unsupported) when calling the CreateInstanceExportTask operation: diskImageFormat 'raw' not supported for targetEnvironment 'vmware'. Valid value(s): ["'vmdk', .

It is possible then to export an EC2 instance as a RAW file? If so, which should be the procedure to perform that operation?

SDK version number

aws-cli/2.11.13 Python/3.11.3

Platform/OS/Hardware/Device

RHEL 8.6

To Reproduce (observed behavior)

  1. Create an instance
  2. Export the instance using aws ec2 create-instance-export-task command.

Expected behavior

  1. It should successfully create a RAW file from the EC2 instance and store it my S3 Bucket

Logs/output

Logs of the failed commands described above

Additional context

N/A

aBurmeseDev commented 1 year ago

Hi @aalcaraz97 thanks for reaching out. I was able to reproduce the same behavior and reached out to EC2 team to confirm if this behavior is intended. If so, I will follow up with the team to find a way to export the instance as RAW file possibly. Best, John

P88830062

aBurmeseDev commented 1 year ago

Hi @aalcaraz97 - I just heard back from a service team member that RAW format is not currently supported for CreateInstanceExportTask API and they recommend using ExportImage API with DiskImageFormat param. Here's AWS CLI docs for the API: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/export-image.html

Please let us know if you have any other questions!

github-actions[bot] commented 1 year ago

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.