diff options
author | Patrick Wendell <pwendell@gmail.com> | 2013-05-08 17:18:21 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2013-05-08 21:46:01 -0700 |
commit | 976e02491e3c0417c416d85b1f9e4f1c52b0200d (patch) | |
tree | bea2e0982ee7e57d74e67549bd1c7e905d6e2c17 /ec2/spark_ec2.py | |
parent | f8213aab4bd3056e0c5a86b6f6d0278162151499 (diff) | |
download | spark-976e02491e3c0417c416d85b1f9e4f1c52b0200d.tar.gz spark-976e02491e3c0417c416d85b1f9e4f1c52b0200d.tar.bz2 spark-976e02491e3c0417c416d85b1f9e4f1c52b0200d.zip |
Resolve AMI region automatically
Diffstat (limited to 'ec2/spark_ec2.py')
-rwxr-xr-x | ec2/spark_ec2.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py index e917fc8dc4..82ad98fbb3 100755 --- a/ec2/spark_ec2.py +++ b/ec2/spark_ec2.py @@ -189,12 +189,14 @@ def get_spark_ami(opts): if version_prefix != "latest": print >> stderr, \ "Don't know how to resolve AMI for version: %s" % version_prefix - ami_path = "%s/%s/%s/%s" % (AMI_PREFIX, version_prefix, "us-east", instance_type) + + region = "-".join(opts.region.split("-")[:2]) + ami_path = "%s/%s/%s/%s" % (AMI_PREFIX, version_prefix, region, instance_type) try: ami = urllib2.urlopen(ami_path).read().strip() print "Spark AMI: " + ami except: - print >> stderr, "Could not read " + ami_path + print >> stderr, "Could not resolve AMI at: " + ami_path sys.exit(1) return ami |