aboutsummaryrefslogtreecommitdiff
path: root/ec2
diff options
context:
space:
mode:
authorJPark <JPark@JPark.me>2015-07-09 10:23:36 -0700
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2015-07-09 10:23:36 -0700
commitc59e268d17cf10e46dbdbe760e2a7580a6364692 (patch)
treeaac7aeb0cec7243e69ce510581af0b4dcd0b323d /ec2
parentf6c0bd5c3755b2f9bab633a5d478240fdaf1c593 (diff)
downloadspark-c59e268d17cf10e46dbdbe760e2a7580a6364692.tar.gz
spark-c59e268d17cf10e46dbdbe760e2a7580a6364692.tar.bz2
spark-c59e268d17cf10e46dbdbe760e2a7580a6364692.zip
[SPARK-8863] [EC2] Check aws access key from aws credentials if there is no boto config
'spark_ec2.py' use boto to control ec2. And boto can support '~/.aws/credentials' which is AWS CLI default configuration file. We can check this information from ref of boto. "A boto config file is a text file formatted like an .ini configuration file that specifies values for options that control the behavior of the boto library. In Unix/Linux systems, on startup, the boto library looks for configuration files in the following locations and in the following order: /etc/boto.cfg - for site-wide settings that all users on this machine will use (if profile is given) ~/.aws/credentials - for credentials shared between SDKs (if profile is given) ~/.boto - for user-specific settings ~/.aws/credentials - for credentials shared between SDKs ~/.boto - for user-specific settings" * ref of boto: http://boto.readthedocs.org/en/latest/boto_config_tut.html * ref of aws cli : http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html However 'spark_ec2.py' only check boto config & environment variable even if there is '~/.aws/credentials', and 'spark_ec2.py' is terminated. So I changed to check '~/.aws/credentials'. cc rxin Jira : https://issues.apache.org/jira/browse/SPARK-8863 Author: JPark <JPark@JPark.me> Closes #7252 from JuhongPark/master and squashes the following commits: 23c5792 [JPark] Check aws access key from aws credentials if there is no boto config
Diffstat (limited to 'ec2')
-rwxr-xr-xec2/spark_ec2.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py
index dd0c12d259..ae4f2ecc5b 100755
--- a/ec2/spark_ec2.py
+++ b/ec2/spark_ec2.py
@@ -325,14 +325,16 @@ def parse_args():
home_dir = os.getenv('HOME')
if home_dir is None or not os.path.isfile(home_dir + '/.boto'):
if not os.path.isfile('/etc/boto.cfg'):
- if os.getenv('AWS_ACCESS_KEY_ID') is None:
- print("ERROR: The environment variable AWS_ACCESS_KEY_ID must be set",
- file=stderr)
- sys.exit(1)
- if os.getenv('AWS_SECRET_ACCESS_KEY') is None:
- print("ERROR: The environment variable AWS_SECRET_ACCESS_KEY must be set",
- file=stderr)
- sys.exit(1)
+ # If there is no boto config, check aws credentials
+ if not os.path.isfile(home_dir + '/.aws/credentials'):
+ if os.getenv('AWS_ACCESS_KEY_ID') is None:
+ print("ERROR: The environment variable AWS_ACCESS_KEY_ID must be set",
+ file=stderr)
+ sys.exit(1)
+ if os.getenv('AWS_SECRET_ACCESS_KEY') is None:
+ print("ERROR: The environment variable AWS_SECRET_ACCESS_KEY must be set",
+ file=stderr)
+ sys.exit(1)
return (opts, action, cluster_name)