diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py index 3a2361c6d6d2b4abc8785709ec8c0931d8582530..9327e21e43db78ec85fd1f141034a41a2268e996 100755 --- a/ec2/spark_ec2.py +++ b/ec2/spark_ec2.py @@ -181,6 +181,10 @@ 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: %default)") parser.add_option( "-t", "--instance-type", default="m1.large", help="Type of instance to launch (default: %default). " + @@ -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)