diff options
author | teramonagi <teramonagi@gmail.com> | 2015-10-29 10:54:04 -0700 |
---|---|---|
committer | Josh Rosen <joshrosen@databricks.com> | 2015-10-29 13:08:55 -0700 |
commit | f21ef8dbb2ef6526b8b47e18b9d8d91dd520c086 (patch) | |
tree | 4a43b2fd237b25174bd70977fbb4bb4ee9350dec | |
parent | a01cbf5daac148f39cd97299780f542abc41d1e9 (diff) | |
download | spark-f21ef8dbb2ef6526b8b47e18b9d8d91dd520c086.tar.gz spark-f21ef8dbb2ef6526b8b47e18b9d8d91dd520c086.tar.bz2 spark-f21ef8dbb2ef6526b8b47e18b9d8d91dd520c086.zip |
[SPARK-10532][EC2] Added --profile option to specify the name of profile
"profiles" give us the way that you can specify the set of credentials you want to use when you initialize a connection to AWS.
You can keep multiple sets of credentials in the same credentials files using different profile names.
For example, you can use --profile option to do that when you use "aws cli tool".
http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
Author: teramonagi <teramonagi@gmail.com>
Closes #8696 from teramonagi/SPARK-10532.
-rwxr-xr-x | ec2/spark_ec2.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py index 3a2361c6d6..9327e21e43 100755 --- a/ec2/spark_ec2.py +++ b/ec2/spark_ec2.py @@ -182,6 +182,10 @@ def parse_args(): "-i", "--identity-file", help="SSH private key file to use for logging into instances") parser.add_option( + "-p", "--profile", default=None, + help="If you have multiple profiles (AWS or boto config), you can configure " + + "additional, named profiles by using this option (default: %default)") + parser.add_option( "-t", "--instance-type", default="m1.large", help="Type of instance to launch (default: %default). " + "WARNING: must be 64-bit; small instances won't work") @@ -1315,7 +1319,10 @@ def real_main(): sys.exit(1) try: - conn = ec2.connect_to_region(opts.region) + if opts.profile is None: + conn = ec2.connect_to_region(opts.region) + else: + conn = ec2.connect_to_region(opts.region, profile_name=opts.profile) except Exception as e: print((e), file=stderr) sys.exit(1) |