modified scrip to accomodate latest aws changes