From a8b967eab05f27a7ac94f9d62c82d45f8bc188c1 Mon Sep 17 00:00:00 2001 From: Joseph Lawson Date: Tue, 21 Oct 2014 15:53:38 -0400 Subject: [PATCH] eip resources have no required properties. --- moto/ec2/models.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/moto/ec2/models.py b/moto/ec2/models.py index 77f489eb3..17955cc09 100644 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -1946,13 +1946,15 @@ class ElasticAddress(object): @classmethod def create_from_cloudformation_json(cls, resource_name, cloudformation_json): - properties = cloudformation_json['Properties'] + properties = cloudformation_json.get('Properties') + instance_id = None + if properties: + eip = ec2_backend.allocate_address( + domain=properties.get('Domain')) + instance_id = properties.get('InstanceId') + else: + eip = ec2_backend.allocate_address() - eip = ec2_backend.allocate_address( - domain=properties['Domain'] - ) - - instance_id = properties.get('InstanceId') if instance_id: instance = ec2_backend.get_instance_by_id(instance_id) ec2_backend.associate_address(instance, address=eip.public_ip)