refactored aws factory out