def main():
  connection = common.connect()
  region = common.prompt_region(connection)
  connection = common.connect(region)
  zone = common.prompt_zone(connection)
  security_group = common.prompt_security_group(connection)
  prefix = "{}-{}-".format(security_group, zone.split("-")[-1])
  name = _prompt_name(connection, prefix)
  instance_type = _prompt_instance_type()
  key_path = common.prompt_key_path()
  key_name = os.path.basename(key_path).split(".")[0]

  arguments = _LaunchArguments(instance_type=instance_type,
                               key_name=key_name,
                               name=name,
                               security_group=security_group,
                               zone=zone)

  env.host_string = _launch(connection, arguments, region)
  env.key_filename = key_path
  env.user = _USERNAME
  common.wait_until_remote_reachable()
  sudo("hostname {}".format(name))
  _update_system_files(name)
  _install()
  _update_installed_files()
  reboot()

  if instance_type.ephemeral_disk_count > 1:
    _create_ephemeral_raid(instance_type.ephemeral_disk_count)
  
  if _GIT_REPO:
    _clone()
def main():
  connection = common.connect()

  instance = common.prompt_instance(connection,
    "Which instance to create a RAID for")
  if not instance:
    sys.exit("Instance not found.")

  key_path = common.get_pem(instance)
  print("Using key: {}".format(key_path))

  env.host_string = instance.public_dns_name
  env.key_filename = key_path
  env.user = _USERNAME

  number_of_disks = common.prompt_choice(
    "How many EBS volumes should be in the RAID array", range(1, 11), 4)
  size_of_disks = _prompt_size()
  level = common.prompt_choice("Level", _LEVELS, _DEFAULT_LEVEL)

  common.wait_until_remote_reachable()

  possible_device_paths = ["/dev/sd" + chr(letter)
    for letter in range(ord("f"), ord("z") + 1)]

  # Remove used device paths from the list
  used_devices = _get_existing_device_paths()

  for used_device in used_devices:
    used_device_no_trailing_digits = re.sub("\d+$", "", used_device)
    if used_device_no_trailing_digits in possible_device_paths:
      possible_device_paths.remove(used_device_no_trailing_digits)

  # Offer the user a prompt of which device path to beginning with
  prefix_device_path = common.prompt_choice(
    "Volumes should be attached with numbers appended to which device path",
    possible_device_paths[:9], 1)

  # Create the disks
  new_volume_device_strings = []
  for index in range(number_of_disks):
    device_string = prefix_device_path + str(index + 1)  # example: /dev/sdf2
    new_volume_device_strings.append(device_string)
    _create_ebs_volume(connection, instance, size_of_disks, device_string)

  # Figure out where to attach the new RAID
  possible_devices_for_raid = ["/dev/md" + str(index) for index in range(10)]
  for used_device in used_devices:
    if used_device in possible_devices_for_raid:
      possible_devices_for_raid.remove(used_device)
  raid_device_path = common.prompt_choice(
      "The RAID should be built at which device path",
        possible_devices_for_raid[:5], 1)

  print("Where do you want the RAID directory to be? [Default: /mnt/raid]")
  raid_directory_path = raw_input()
  if raid_directory_path == "":
    raid_directory_path = "/mnt/raid"

  _create_raid(new_volume_device_strings, level, raid_device_path,
               raid_directory_path)