code: def _set_instance_ip(self):
          
          instance = self._get_instance()
  
          # ipv6
          try:
              ipv6 = instance.network_interfaces[0].ipv6_addresses[0]
          except (IndexError, TypeError):
              ipv6 = None
  
          self.instance_ip = instance.public_ip_address or \
              ipv6 or instance.private_ip_address
  
          if not self.instance_ip:
              raise EC2CloudException(
                  'IP address for instance cannot be found.'
              )
docs: Retrieve instance ip and cache it.
  
          Current preference is for public ipv4, ipv6 and private.