The deal strengthens AWS's AI offerings and may help fend off challenges from cloud rivals Microsoft and Google.