diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py index 11fd7ee0ec8d..dab8265f2271 100755 --- a/ec2/spark_ec2.py +++ b/ec2/spark_ec2.py @@ -177,6 +177,9 @@ def parse_args(): parser.add_option( "-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: None)") parser.add_option( "-t", "--instance-type", default="m1.large", help="Type of instance to launch (default: %default). " + @@ -1311,7 +1314,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)