def automate_vpc_with_subnet_creation(network_configuration, compute_subnet_size): print("Beginning VPC creation. Please do not leave the terminal until the creation is finalized") vpc_creator = VpcFactory(get_region()) vpc_id = vpc_creator.create() vpc_creator.setup(vpc_id, name="ParallelClusterVPC" + TIMESTAMP) if not vpc_creator.check(vpc_id): logging.critical("Something went wrong in VPC creation. Please delete it and start the process again") sys.exit(1) vpc_parameters = {"vpc_id": vpc_id} vpc_parameters.update(automate_subnet_creation(vpc_id, network_configuration, compute_subnet_size)) return vpc_parameters
def _validate_vpc(vpc_id): # This function should be further expandend once we decide to allow the user to use his vpcs. For example, we should # also check for the presence of a NAT gateway if not VpcFactory(get_region()).check(vpc_id): logging.error( "WARNING: The VPC does not have the correct parameters set.")