diff --git a/moto/ec2/models/hosts.py b/moto/ec2/models/hosts.py index d44d39199..b3183fda7 100644 --- a/moto/ec2/models/hosts.py +++ b/moto/ec2/models/hosts.py @@ -1,5 +1,6 @@ from .core import TaggedEC2Resource from ..utils import generic_filter, random_dedicated_host_id +from moto.core.utils import unix_time from typing import Any, Dict, List, Optional @@ -21,6 +22,7 @@ class Host(TaggedEC2Resource): self.instance_family: Optional[str] = instance_family self.auto_placement = auto_placement or "on" self.ec2_backend = backend + self.allocation_time = unix_time() def release(self) -> None: self.state = "released" diff --git a/moto/ec2/responses/hosts.py b/moto/ec2/responses/hosts.py index cb1825c5b..faa856081 100644 --- a/moto/ec2/responses/hosts.py +++ b/moto/ec2/responses/hosts.py @@ -66,6 +66,7 @@ EC2_DESCRIBE_HOSTS = """