new function for connecting to aws instances