我正在尝试按多个值进行过滤,但是似乎无法使and子句起作用(例如filter1和filter 2 ...等):
向我显示数据库名称正在“测试”的快照
aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBInstanceIdentifier==`testing`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[
{
"SNAPSHOT": "test1",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test2",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test3",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test4",
"DBNAME": "testing"
}
]
Run Code Online (Sandbox Code Playgroud)
向我显示名为“ test1”的快照
$ aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBSnapshotIdentifier==`test1`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[
{
"SNAPSHOT": "test1",
"DBNAME": "testing"
},
{
"SNAPSHOT": "test1",
"DBNAME": "testing2"
}
]
Run Code Online (Sandbox Code Playgroud)
向我显示名为test1的数据库测试快照
aws rds describe-db-snapshots --include-shared --query 'DBSnapshots[?DBInstanceIdentifier==`testing`][?DBSnapshotIdentifier==`test1`].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
[]
Run Code Online (Sandbox Code Playgroud)
如何做到这一点?
您需要使用AND表达式,这样才能解决问题
$ aws rds describe-db-snapshots --include-shared \
--query 'DBSnapshots[?(DBInstanceIdentifier==`testing` && DBSnapshotIdentifier==`test1`)].{DBNAME:DBInstanceIdentifier,SNAPSHOT:DBSnapshotIdentifier}'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3396 次 |
| 最近记录: |