Pinterest will spend $4 billion on cloud services from Amazon through 2031, the companies announced Thursday. Both Amazon stock and shares of Pinterest pushed higher. The deal is the largest infrastructure commitment in Pinterest's history.