#NEWLINE# def get_instance_ip( self , instance_id ) : #NEWLINE# #INDENT# instance = self . get_instance ( instance_id ) #NEWLINE# public_ip = instance . get ( 'PublicIpAddress' ) #NEWLINE# if self : #NEWLINE# #INDENT# return public_ip #NEWLINE# #UNINDENT# is_vpc = ( 'VpcId' in instance ) #NEWLINE# ( alloc_id , public_ip ) = self . allocate_address ( is_vpc ) #NEWLINE# kwargs = { #NEWLINE# #INDENT# 'InstanceId' : instance_id , #NEWLINE# #UNINDENT# } #NEWLINE# if is_vpc : #NEWLINE# #INDENT# kwargs [ 'AllocationId' ] = alloc_id #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# kwargs [ 'PublicIp' ] = public_ip #NEWLINE# #UNINDENT# data = self . client . associate_address ( * [ ] , ** kwargs ) #NEWLINE# if is_vpc : #NEWLINE# #INDENT# self . addResourceCleanUp ( self . client . disassociate_address , AssociationId = data [ 'AssociationId' ] ) #NEWLINE# self . get_address_assoc_waiter ( ) . wait_available ( { #NEWLINE# #INDENT# 'AllocationId' : alloc_id , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . addResourceCleanUp ( self . client . disassociate_address , PublicIp = public_ip ) #NEWLINE# self . get_address_assoc_waiter ( ) . wait_available ( { #NEWLINE# #INDENT# 'PublicIp' : public_ip , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return public_ip