def get_instance_ip_by_name(name=None): conn = connect_ec2.get_connection() try: instance = _get_instance_by_name(conn, name) print instance.public_dns_name except: print 'Failed to find instance'
def stop_instance_by_name(name=None): conn = connect_ec2.get_connection() try: instance = _get_instance_by_name(conn, name) conn.stop_instances([instance.id]) print 'Done' except: print 'Failed to stop instance'