Detect whether we run on EC2 using ec2-metadata as well

Fixes SPARK-613 when we are using the Spark AMI