Nice idea, but needs a bit of refactoring:<p>hardcoded paths like &#x27;&#x2F;tmp&#x2F;.ssh2_list&#x27; should not be used. This is insecure and wouldn&#x27;t work on (most) multi user systems.  Something like os.path.expanduser(&quot;~&#x2F;.cache&#x2F;ssh2_list&quot;) should be used instead.<p><pre><code>  f = open(cache_file_list, &#x27;w&#x27;)
  f.write(output)
  f.close()
</code></pre>
can be written as<p><pre><code>  with open(cache_file_list, &#x27;w&#x27;) as f:
    f.write(output)
</code></pre>
This:<p><pre><code>  i = 0
  for instance in all_instances:
    i += 1
    #..
    print &#x27;%-4s%-55s%-30s&#x27; % (&#x27;[&#x27; + str(i) + &#x27;]&#x27;,
      instance[&#x27;PublicDnsName&#x27;], name)
</code></pre>
Simplifies to:<p><pre><code>  for i, instance in enumerate(all_instances, 1):
    choice = &#x27;[%d]&#x27; % i
    name = extract_name(instance) #function instead of copy&#x2F;paste    
    print &#x27;%-4s %-55s %-30s&#x27; % (choice, instance[&#x27;PublicDnsName&#x27;], name)
</code></pre>
Also would kind of make more sense to support matching on the name of the instance rather than requiring a number.  In your case, &#x27;ssh2 cron&#x27; makes a bit more sense than &#x27;ssh2 0&#x27;