Clone of the original aws implementation, with some tweaks for newer boto