adapted to AWS CLI 1.0 + minor editing