def _set_instance_ip(self):
instance = self._get_instance()<EOL>try:<EOL><INDENT>ipv6 = instance.network_interfaces[<NUM_LIT:0>].ipv6_addresses[<NUM_LIT:0>]<EOL><DEDENT>except (IndexError, TypeError):<EOL><INDENT>ipv6 = None<EOL><DEDENT>self.instance_ip = instance.public_ip_address oripv6 or instance.private_ip_address<EOL>if not self.instance_ip:<EOL><INDENT>raise EC2CloudException(<EOL>'<STR_LIT>'<EOL>)<EOL><DEDENT>
Retrieve instance ip and cache it.

Current preference is for public ipv4, ipv6 and private.