Below is the JSON result (for one volume) I get from running aws ec2 describe-volumes
:
{
"AvailabilityZone": "eu-west-1a",
"Attachments": [
{
"AttachTime": "2015-02-23T15:01:37.000Z",
"InstanceId": "i-abcd1234",
"VolumeId": "vol-pqrs1234",
"State": "attached",
"DeleteOnTermination": true,
"Device": "/dev/xvda"
}
],
"Tags": [
{
"Value": "on",
"Key": "snapshot"
},
{
"Value": "srv001: /",
"Key": "Name"
}
],
"Encrypted": false,
"VolumeType": "gp2",
"VolumeId": "vol-pqrs1234",
"State": "in-use",
"Iops": 24,
"SnapshotId": "snap-klmn1234",
"CreateTime": "2015-02-23T15:01:37.000Z",
"Size": 8
},
Using Python Boto, I can get a list of volume ids, using filters.
volumes = conn.get_all_volumes(filters={"tag:snapshot" : "on"})
I would like to filter on "State: in-use" and possibly other values, and do something similar for snapshots. I can't find the proper filter names. Filters like "state" or "attachment.state" are not allowed:
The filter 'attachment.state' is invalid
What are the proper filter names, or where can I find them?