So, three things you can do:
Use the web interface. Amazon gives you access to this as detailed here
Run the query in screen and then if you get disconnected, just reconnect and reattach to your previous session. You can also point the logging to happen to some file instead of stdout so you can then just reopen this when you log back on to the machine
Run the query using nohup so it's not attached to any session and will keep running on its own even after you get kicked off. Again, pipe all logging to some file rather than stdout and then just check that file or tail it once you log back on.