Pinterest announced a $4 billion commitment to Amazon Web Services for cloud services through 2031, marking the social media company's largest-ever deal.

The partnership will see Amazon's cloud unit provide custom chip processors, including Graviton and Trainium, to power Pinterest's AI initiatives.

"This expanded commitment gives us the compute flexibility and hardware optionality to accelerate our AI vision," said Pinterest CTO Matt Madrigal.

The company has been investing heavily in AI tools to compete with TikTok, Meta's Instagram and Facebook, upgrading its Performance+ ad suite to drive growth.

Pinterest shares rose nearly 5% on the news, while Amazon gained 1.7%.