aws describe-volumes行为

时间:2017-07-10 23:52:58

标签: amazon-web-services aws-cli

我对aws describe-volumes的过滤器无效。不确定出了什么问题。 attachment.status的所有不同可能值都不返回任何卷。音量实际上很好。以下是文档:http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-volumes.html

root@84837b512326:/app# aws ec2 describe-volumes --filters 
Name=attachment.status,Values=detaching --volume-ids vol-0e244fb776d97de63 
{
     "Volumes": []    
}
root@84837b512326:/app# aws ec2 describe-volumes --filters Name=attachment.status,Values=detached --volume-ids vol-0e244fb776d97de63 
{
    "Volumes": []
}
root@84837b512326:/app# aws ec2 describe-volumes --filters Name=attachment.status,Values=attached --volume-ids vol-0e244fb776d97de63 
{
    "Volumes": []
}
root@84837b512326:/app# aws ec2 describe-volumes --filters Name=attachment.status,Values=attaching --volume-ids vol-0e244fb776d97de63 

{
    "Volumes": []
}
root@84837b512326:/app# aws ec2 describe-volumes --volume-ids vol-0e244fb776d97de63 
{
    "Volumes": [
    {
        "AvailabilityZone": "us-west-2b", 
        "Attachments": [
            {
                "AttachTime": "2017-07-10T23:18:36.000Z", 
                "InstanceId": "i-07ad32a6d30cb3081", 
                "VolumeId": "vol-0e244fb776d97de63", 
                "State": "busy", 
                "DeleteOnTermination": false, 
                "Device": "/dev/sdb"
            }
        ], 
        "Encrypted": false, 
        "VolumeType": "gp2", 
        "VolumeId": "vol-0e244fb776d97de63", 
        "State": "in-use", 
        "Iops": 100, 
        "SnapshotId": "", 
        "CreateTime": "2017-07-10T20:15:25.154Z", 
        "Size": 5
    }
]
}

1 个答案:

答案 0 :(得分:0)

您正在滥用--filters参数。

它需要--filter Name="instance-id",Values="i-1234abcd"形式的参数;请注意字符串传递的引号。