refactor aws connection args logic