Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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 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. Instead, it has PublicIp and PublicIpAddress fields that contain the ip address which I am looking for.

How does this filter work?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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. One of them ip-address:

ip-address – The public IPv4 address of the instance.

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.

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. All the filtering is happening in the back-end.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading