Amazon Import Export

I have successfully imported from vmware ova to aws ami and run without problems the instance generated.

The process is very well documented in the page http://docs.aws.amazon.com/vm-import/latest/userguide/what-is-vmimport.html especially in the section "Image Import"

It is nice have some clear points:

  • there isn't a webconsole today 19 October 2016 you can use only by PowerShell (windows), CLI (Linux), SDK (many languages)
  • you can use external tool to do that but I haven't tried them, AWS Connector for vCenter and for Microsoft SCVMM , you can find how to in the aws documentation
  • In the documentation there are two kind of import Image or Instance , from the option the Image option is for sure the best choice with less limitation.

On 24th October 2016 there was a remarkable update on this kind of import operation , you can see the post on AWS blog here https://aws.amazon.com/blogs/aws/new-aws-server-migration-service/ . Now it is possible to do an hot import of a machine, this is interesting for very big machines to reduce the service disruption.

before deliver in "production" the new image remove the key file in /home/ec2-user/.ssh/authorized_key

Cloud-init

When you import a Linux machine you need to install the cloud-init program so when you create a machine the key is stored the user-data script is run ecc.

The hostname situation

by default any image take the name from the from http://169.254.169.254/latest/meta-data/local-hostname but it is not possible change at this level

I checked with the Support Operations team just to be sure and unfortunately there is no way to change the instance metadata that is obtained from http://169.254.169.254/latest/meta-data. Not just hostname, none of the fields in the meta-data can be updated.

the fully qualified name hostname -f came from the AWS default dns because the virtual machines check is hostname and in the /etc/resolv.conf there is like first search the dns for that region
  • don't change the /etc/cloud/cloud.cfg (this file is replaced every update) but put the config in the directory /etc/cloud/cloud.cfg.d
  • to have the hostname -f working you need to enable the management of the /etc/hosts from the template
cat /etc/cloud/cloud.cfg.d/50_hosts.cfg
preserve_hostname: false
manage_etc_hosts: True
  • in the user-data field at machine creation time you put this code with the updates name
#!/bin/bash
echo 'fqdn: pppp.aaaa.bbb' >> /etc/cloud/cloud.cfg.d/99_hostname.cfg
echo 'hostname: pppp' >> /etc/cloud/cloud.cfg.d/99_hostname.cfg
reboot
  • in this way the template of your configuration will be used in my case where I used red hat was this /etc/cloud/templates/hosts.redhat.tmpl

useful documentation about cloud-init :

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License