amazon ec2 - Python Boto EC2 find instance given its IP address -


using boto in python, how can find boto.ec2 instance object given ip address?

digging through boto documentation, found get_only_instances method, use instances. can pass filter dictionary it, filter ip address (i found in ec2 api reference under filter.n title).

so example, instance ip 1.1.1.1, do:

filters = {"ip-address": "1.1.1.1"} result_list = conn.get_only_instances(filters=filters) 

then result_list[0] should instance object instance ip address.


Comments

Popular posts from this blog

python 3 IndexError: list index out of range -

android - How to save instance state of selected radiobutton on menu -

IF statement in MySQL trigger -