@Inject
  public AwsEc2UnicastHostsProvider(
      Settings settings,
      TransportService transportService,
      AwsEc2Service awsEc2Service,
      Version version) {
    super(settings);
    this.transportService = transportService;
    this.client = awsEc2Service.client();
    this.version = version;

    this.hostType =
        HostType.valueOf(
            settings.get("discovery.ec2.host_type", "private_ip").toUpperCase(Locale.ROOT));

    this.bindAnyGroup = settings.getAsBoolean("discovery.ec2.any_group", true);
    this.groups = new HashSet<>();
    groups.addAll(Arrays.asList(settings.getAsArray("discovery.ec2.groups")));

    this.tags = settings.getByPrefix("discovery.ec2.tag.").getAsMap();

    Set<String> availabilityZones = new HashSet();
    availabilityZones.addAll(
        Arrays.asList(settings.getAsArray("discovery.ec2.availability_zones")));
    if (settings.get("discovery.ec2.availability_zones") != null) {
      availabilityZones.addAll(
          Strings.commaDelimitedListToSet(settings.get("discovery.ec2.availability_zones")));
    }
    this.availabilityZones = availabilityZones;

    if (logger.isDebugEnabled()) {
      logger.debug(
          "using host_type [{}], tags [{}], groups [{}] with any_group [{}], availability_zones [{}]",
          hostType,
          tags,
          groups,
          bindAnyGroup,
          availabilityZones);
    }
  }