diff --git a/moto/ec2/models.py b/moto/ec2/models.py index c685d81a..8970fd66 100644 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -1453,6 +1453,9 @@ class Volume(TaggedEC2Resource): if filter_name == 'status': return self.status + if filter_name == 'volume-id': + return self.id + filter_value = super(Volume, self).get_filter_value(filter_name) if filter_value is None: diff --git a/tests/test_ec2/test_elastic_block_store.py b/tests/test_ec2/test_elastic_block_store.py index 3d50e83b..05a0e72d 100644 --- a/tests/test_ec2/test_elastic_block_store.py +++ b/tests/test_ec2/test_elastic_block_store.py @@ -95,6 +95,9 @@ def test_volume_filters(): volumes_by_status = conn.get_all_volumes(filters={'status': 'in-use'}) set([vol.id for vol in volumes_by_status]).should.equal(set([block_mapping.volume_id])) + volumes_by_id = conn.get_all_volumes(filters={'volume-id': volume1.id}) + set([vol.id for vol in volumes_by_id]).should.equal(set([volume1.id])) + volumes_by_tag_key = conn.get_all_volumes(filters={'tag-key': 'testkey1'}) set([vol.id for vol in volumes_by_tag_key]).should.equal(set([volume1.id]))