Tutorial How to Import/Export Virtual Machine Images on AWS
First thing may all know this but only intended to Beginners
Some times you might need to use a pre-configured image in cloud environment as well as on-premise servers with virtualization. Amazon Web Services support importing VM to Amazon Machine Images and Exporting Imported instances. Please note AWS only officially support for exporting previously imported instances. That means you will not be able to export a regular ec2 instance to Virtual Machine Image.
In this guide we will create a Virtual Machine image in Ova format in our local server and import it to AWS. There are few things that I have tried and failed.
I tried to use the official Virtual Image provided by Canonical and importing it in to AWS. But did not work. Then I tried to download it (the VM image) to my local machine and to create a VM using virtual box. It did work either
Requirements:-
This is a pretty simple step. You just have to download iso image from ubuntu official repo and create a virtual machine with VirtualBox. Then in VirtualBox menu go to File->Export Appliance and Export the VM to ovf format. I have exported my vm as ubuntu_vmi.ova
Upload Ova Image to S3
Once the export is completed. Create a s3 bucket in AWS S3. I have created a bucket named ubuntuvirtualmachineimages. Then copy local ubuntu_vmi.ova to that bucket using aws cli.
This would take some time to upload
Creating Amazon Machine Image from Ova Image
1.Create trust-policy.json
You can do the same visually with IAM AWS Console, in Roles tab
2.Create role-policy.json. You have to replace <YOUR_S3_BUCKET_NAME> with your bucket name.
4.Attache policy to role
5.Create containers.json
Import the Image
Check Status of the task
Some times you might need to use a pre-configured image in cloud environment as well as on-premise servers with virtualization. Amazon Web Services support importing VM to Amazon Machine Images and Exporting Imported instances. Please note AWS only officially support for exporting previously imported instances. That means you will not be able to export a regular ec2 instance to Virtual Machine Image.
In this guide we will create a Virtual Machine image in Ova format in our local server and import it to AWS. There are few things that I have tried and failed.
I tried to use the official Virtual Image provided by Canonical and importing it in to AWS. But did not work. Then I tried to download it (the VM image) to my local machine and to create a VM using virtual box. It did work either
Requirements:-
- aws cli configured in your local computer
- VirtualBox
This is a pretty simple step. You just have to download iso image from ubuntu official repo and create a virtual machine with VirtualBox. Then in VirtualBox menu go to File->Export Appliance and Export the VM to ovf format. I have exported my vm as ubuntu_vmi.ova
Upload Ova Image to S3
Once the export is completed. Create a s3 bucket in AWS S3. I have created a bucket named ubuntuvirtualmachineimages. Then copy local ubuntu_vmi.ova to that bucket using aws cli.
This would take some time to upload
Creating Amazon Machine Image from Ova Image
1.Create trust-policy.json
You can do the same visually with IAM AWS Console, in Roles tab
2.Create role-policy.json. You have to replace <YOUR_S3_BUCKET_NAME> with your bucket name.
4.Attache policy to role
5.Create containers.json
Import the Image
Check Status of the task
You need to be registered to see the hidden links