diff --git a/moto/ec2/models.py b/moto/ec2/models.py index dfc912ff0..502122969 100755 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -377,6 +377,7 @@ class Instance(TaggedEC2Resource, BotoInstance): self.subnet_id = kwargs.get("subnet_id") in_ec2_classic = not bool(self.subnet_id) self.key_name = kwargs.get("key_name") + self.ebs_optimized = kwargs.get("ebs_optimized", False) self.source_dest_check = "true" self.launch_time = utc_date_and_time() self.disable_api_termination = kwargs.get("disable_api_termination", False) diff --git a/moto/ec2/responses/instances.py b/moto/ec2/responses/instances.py index cae9631ea..3e4705f92 100644 --- a/moto/ec2/responses/instances.py +++ b/moto/ec2/responses/instances.py @@ -45,6 +45,7 @@ class InstanceResponse(BaseResponse): private_ip = self._get_param('PrivateIpAddress') associate_public_ip = self._get_param('AssociatePublicIpAddress') key_name = self._get_param('KeyName') + ebs_optimized = self._get_param('EbsOptimized') tags = self._parse_tag_specification("TagSpecification") region_name = self.region @@ -54,7 +55,7 @@ class InstanceResponse(BaseResponse): instance_type=instance_type, placement=placement, region_name=region_name, subnet_id=subnet_id, owner_id=owner_id, key_name=key_name, security_group_ids=security_group_ids, nics=nics, private_ip=private_ip, associate_public_ip=associate_public_ip, - tags=tags) + tags=tags, ebs_optimized=ebs_optimized) template = self.response_template(EC2_RUN_INSTANCES) return template.render(reservation=new_reservation) @@ -242,6 +243,7 @@ EC2_RUN_INSTANCES = """