diff --git a/moto/ec2/models.py b/moto/ec2/models.py index 201754cf3..a8724e655 100644 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -263,7 +263,7 @@ class Instance(BotoInstance, TaggedEC2Instance): self.key_name = kwargs.get("key_name") self.block_device_mapping = BlockDeviceMapping() - self.block_device_mapping['/dev/sda1'] = BlockDeviceType() + self.block_device_mapping['/dev/sda1'] = BlockDeviceType(volume_id=random_volume_id()) amis = ec2_backend.describe_images(filters={'image-id': image_id}) ami = amis[0] if amis else None diff --git a/moto/ec2/responses/instances.py b/moto/ec2/responses/instances.py index c92de014b..27625341d 100644 --- a/moto/ec2/responses/instances.py +++ b/moto/ec2/responses/instances.py @@ -340,7 +340,17 @@ EC2_DESCRIBE_INSTANCES = """ + attached + YYYY-MM-DDTHH:MM:SS.SSSZ + true + + + {{ instance.virtualization_type }} ABCDE1234567890123 diff --git a/tests/test_ec2/test_instances.py b/tests/test_ec2/test_instances.py index 910944ace..a65f3436f 100644 --- a/tests/test_ec2/test_instances.py +++ b/tests/test_ec2/test_instances.py @@ -50,6 +50,10 @@ def test_instance_launch_and_terminate(): instances[0].id.should.equal(instance.id) instances[0].state.should.equal('running') + root_device_name = instances[0].root_device_name + instances[0].block_device_mapping[root_device_name].status.should.equal('attached') + instances[0].block_device_mapping[root_device_name].volume_id.should.match(r'vol-\w+') + conn.terminate_instances([instances[0].id]) reservations = conn.get_all_instances()