'IpRanges': [{ 'CidrIp': '0.0.0.0/0', 'Description': 'HTTP'}]}, {'IpProtocol': 'tcp', 'FromPort': 80, 'ToPort': 80, 'IpRanges': [{ 'CidrIp': '0.0.0.0/0', 'Description': 'HTTP'}]}] # -------------------------------------------- create the security groups ------------------------------------------------ mon_security_group_name = 'Mongo' mon_des= 'Mongo' mon_secure = analytics_functions.create_security_group(mon_security_group_name, mon_des, mongo_permissions, ec2) mys_security_group_name = 'MySQL' mys_des = 'MySQL' mys_secure = analytics_functions.create_security_group(mys_security_group_name, mys_des, mysql_permissions, ec2) web_security_group_name = 'Server' web_des = 'Server' web_secure = analytics_functions.create_security_group(web_security_group_name, web_des, web_permissions, ec2) # -------------------------------------------- create the key_pair ------------------------------------------------ key_pair = 'mongo-sql-server' # test to see if this key name already exists analytics_functions.create_key_pair(key_pair, ec2)
}] }] # Check to see if security group already exists valid = False while (not valid): security_group_name = input( 'Please enter desired name for your new security group. Ensure that the name has not been used for another group: ' ) security_group_description = input( 'Please enter desired description for your new security group: ') try: # try creating the group, if error, redo security_group_id = analytics_functions.create_security_group( security_group_name, security_group_description, permissions, ec2) valid = True except: print('It seems like the name is already taken, try another') ### Create your key pair into local directory for SSH purposes ### valid = False while (not valid): try: key_pair = input( 'Please enter your desired new key name that does not already exist: ' ) # test to see if this key name already exists analytics_functions.create_key_pair(key_pair, ec2) valid = True