chi*_*ran 4 amazon-web-services amazon-rds aws-cli
当我们使用过滤器运行命令时,出现错误:
$ aws rds describe-db-instances --filters Name=instance-state-name,Values=running
An error occurred (InvalidParameterValue) when calling the
DescribeDBInstances operation: Unrecognized filter name: instance-state-name.
Run Code Online (Sandbox Code Playgroud)
使用过滤器的正确语法是什么aws rds describe-db-instances?
您的语法似乎不错,但是instance-state-name对于RDS而言,它根本不是有效的过滤器。
从文档中:
--filters (list)
A filter that specifies one or more DB instances to describe.
Supported filters:
db-cluster-id - Accepts DB cluster identifiers and DB cluster Ama-
zon Resource Names (ARNs). The results list will only include
information about the DB instances associated with the DB Clusters
identified by these ARNs.
db-instance-id - Accepts DB instance identifiers and DB instance
Amazon Resource Names (ARNs). The results list will only include
information about the DB instances identified by these ARNs.
Run Code Online (Sandbox Code Playgroud)
由于instance-state-nameRDS并不存在,因此我假设您要搜索的是DBInstanceStatus。虽然无法使用它--filter进行过滤,但可以使用--query:
aws rds describe-db-instances --query 'DBInstances[?DBInstanceStatus==`available`]'
Run Code Online (Sandbox Code Playgroud)
--filter和之间的区别在于,--query它--filter直接影响API发送回的内容,而--query对从API接收到的结果进行局部过滤。只要您没有大量RDS实例,就--query可以正常使用。
| 归档时间: |
|
| 查看次数: |
4306 次 |
| 最近记录: |