summaryrefslogtreecommitdiff
path: root/buildscripts/aws_ec2.py
diff options
context:
space:
mode:
authorEddie Louie <eddie.louie@mongodb.com>2018-01-17 19:56:37 -0500
committerEddie Louie <eddie.louie@mongodb.com>2018-01-19 13:00:20 -0500
commitc2601667cb409d762e9f0baa9c175f274a51e72c (patch)
treeac4577d1cb3bbc0809adbfc301ba4f16046ccbcf /buildscripts/aws_ec2.py
parent60b8011a2f76d14283076a94eac4a9dbec5838bc (diff)
downloadmongo-c2601667cb409d762e9f0baa9c175f274a51e72c.tar.gz
SERVER-32520 Add VPC support for launching AWS EC2 instances
Diffstat (limited to 'buildscripts/aws_ec2.py')
-rwxr-xr-xbuildscripts/aws_ec2.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/buildscripts/aws_ec2.py b/buildscripts/aws_ec2.py
index 58fc1892664..4a92e5c9633 100755
--- a/buildscripts/aws_ec2.py
+++ b/buildscripts/aws_ec2.py
@@ -156,7 +156,9 @@ class AwsEc2(object):
instance_type,
block_devices=None,
key_name=None,
+ security_group_ids=None,
security_groups=None,
+ subnet_id=None,
tags=None,
wait_time_secs=0,
show_progress=False,
@@ -175,8 +177,12 @@ class AwsEc2(object):
bdms.append(bdm)
if bdms:
kwargs["BlockDeviceMappings"] = bdms
+ if security_group_ids:
+ kwargs["SecurityGroupIds"] = security_group_ids
if security_groups:
kwargs["SecurityGroups"] = security_groups
+ if subnet_id:
+ kwargs["SubnetId"] = subnet_id
if key_name:
kwargs["KeyName"] = key_name
@@ -257,6 +263,13 @@ def main():
default=None,
help="EC2 key name [REQUIRED for create].")
+ create_options.add_option("--securityGroupIds",
+ dest="security_group_ids",
+ action="append",
+ default=[],
+ help="EC2 security group ids. More than one security group id can be"
+ " added, by specifying this option more than once.")
+
create_options.add_option("--securityGroup",
dest="security_groups",
action="append",
@@ -264,6 +277,11 @@ def main():
help="EC2 security group. More than one security group can be added,"
" by specifying this option more than once.")
+ create_options.add_option("--subnetId",
+ dest="subnet_id",
+ default=None,
+ help="EC2 subnet id to use in VPC.")
+
create_options.add_option("--tagExpireHours",
dest="tag_expire_hours",
type=int,
@@ -325,7 +343,9 @@ def main():
instance_type=options.instance_type,
block_devices=block_devices,
key_name=options.key_name,
+ security_group_ids=options.security_group_ids,
security_groups=options.security_groups,
+ subnet_id=options.subnet_id,
tags=tags,
wait_time_secs=options.wait_time_secs,
show_progress=True,