copied all spark-ec2 codes here