From 4a92f9fdb003f4165dc654408f90106b57fede6d Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Wed, 12 Oct 2016 22:14:45 -0400 Subject: [PATCH] Fix IP setting. --- moto/ec2/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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