Converting images
This is a step by step guide on how to convert an AWS AMI image to deploy on Sunlight. Note that an AMI can be created from any standard VM running in AWS by taking a snapshot.
AWS AMI to Sunlight image conversion
The AWS CLI provides an export-image function that creates a standard image file from any specified AMI. The resulting image format can be: VHD (Hyper-V, Citrix), VMDK (VMWare) or Raw.
For this AWS CLI function to work the user must have an S3 bucket available. The procedure is as follows:
- Create a common linux VM and install the AWS CLI tools
- Create an S3 bucket.
-
Execute the aws ec2 export-image command converting the output to a raw image format and the target S3 bucket.
aws ec2 export-image --image-id ami-id --disk-image-format RAW --s3-export-location S3Bucket=my-export-bucket,S3Prefix=exports/
Note
Once the export has completed, the raw file must be made accessible to the VM either by mounting the S3 bucket as a local filesystem or by using a CURL command to download the object
-
Convert the raw image file to qcow2 using qemu-img.
qemu-img convert -f raw -O qcow2 <image>.img <image>.qcow2
-
The qcow2 image can now be added to a template server using one of the methods described in the 'Template Repository' section of the docs.
For more details about the process for exporting using the AWS CLI click here
Disclaimer note
Sometimes the relevant drivers are required in order to obtain maximum performance or to achieve full compatibility with the Sunlight platform.