Yeah I'd prefer to not add EC2 specific hacks to the scripts if possible -- Also I am not sure what is the problem here ? We do set SPARK_PUBLIC_DNS in spark-env.sh in our EC2 scripts
https://github.com/mesos/spark-ec2/blob/v2/templates/root/spark/conf/spark-env.sh#L30