fix installation with --template option and get public ip.

Fix installation when pass --template option.
Fix function which returns public ip using opendns.com
Could you revert this change? This is supposed to be very specific to AWS. When running in a VM inside a laptop inside a corporate network, the user doesn't really want to use the company's public IP.