diff --git a/moto/ec2/models.py b/moto/ec2/models.py index 418cac3f..1e43dbb9 100755 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -2667,7 +2667,8 @@ class ElasticAddressBackend(object): eip.eni.public_ip = eip.public_ip if eip.domain == "vpc": eip.association_id = random_eip_association_id() - instance.set_ip(eip.public_ip) + if instance: + instance.set_ip(eip.public_ip) return eip