Skip to content
Snippets Groups Projects
Commit 976e0249 authored by Patrick Wendell's avatar Patrick Wendell
Browse files

Resolve AMI region automatically

parent f8213aab
No related branches found
No related tags found
No related merge requests found
...@@ -189,12 +189,14 @@ def get_spark_ami(opts): ...@@ -189,12 +189,14 @@ def get_spark_ami(opts):
if version_prefix != "latest": if version_prefix != "latest":
print >> stderr, \ print >> stderr, \
"Don't know how to resolve AMI for version: %s" % version_prefix "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: try:
ami = urllib2.urlopen(ami_path).read().strip() ami = urllib2.urlopen(ami_path).read().strip()
print "Spark AMI: " + ami print "Spark AMI: " + ami
except: except:
print >> stderr, "Could not read " + ami_path print >> stderr, "Could not resolve AMI at: " + ami_path
sys.exit(1) sys.exit(1)
return ami return ami
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment