refactor aws.js