简体   繁体   English

AWS CLI EC2 描述实例命令; `ip-address` 过滤器是如何工作的?

[英]AWS CLI EC2 describe-instances command; how does the `ip-address` filter work?

I am learning how to use the CLI tool for AWS and I come across this command:我正在学习如何使用 AWS 的 CLI 工具,我遇到了这个命令:

aws ec2 describe-instances --filters "Name=ip-address,Values=my.test.ip.address"

The command works fine and I can see the EC2 instance details in the command output, however, it does not have any field with the name ip-address .该命令运行良好,我可以在命令 output 中看到 EC2 实例详细信息,但是,它没有任何名称为ip-address字段。 Instead, it has PublicIp and PublicIpAddress fields that contain the ip address which I am looking for.相反,它具有包含我正在寻找的 ip 地址的PublicIpPublicIpAddress字段。

How does this filter work?这个过滤器是如何工作的?

There is a list of keys which can be used to filter on.有一个可用于过滤的键列表。 This can be found in the documentation for the describe-instances command: --filter .这可以在describe-instances命令的文档中找到: --filter One of them ip-address :其中之一ip-address

ip-address - The public IPv4 address of the instance. ip-address - 实例的公有 IPv4 地址。

I did not take a look on the source code for the describe-instances , but I believe it parses the JSON response and it has a preconfigured path for each of the filters.我没有查看describe-instances的源代码,但我相信它会解析 JSON 响应,并且每个过滤器都有一个预配置的路径。

Update:更新:

After takin a look at the source code if aws-cli on GitHub , all the commands are transformed into API calls and send to AWS.查看源代码 if aws-cli on GitHub 后,所有命令都转换为 API 调用并发送到 AWS。 All the filtering is happening in the back-end.所有过滤都发生在后端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM