aboutsummaryrefslogtreecommitdiff
path: root/ec2/spark_ec2.py
diff options
context:
space:
mode:
Diffstat (limited to 'ec2/spark_ec2.py')
-rwxr-xr-xec2/spark_ec2.py6
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