The main difference between AWS STS and Amazon Cognito is the purpose they serve. AWS STS provides temporary credentials to grant users access to AWS services, while Amazon Cognito primarily focuses on providing user authentication and authorization for applications. AWS STS gives trusted users secure access to other services within the same account, while Amazon Cognito allows developers to easily add user authentication and authorization to their applications with minimal configuration.