Refactored code to the new version of the AWS PHP SDK