The most elegant approach to thumbnail generation is to use AWS Lambda. We can use Amazon S3’s event publishing mechanism to invoke the Lambda function and generate the thumbnails.
See AWS Lambda function written in Python that listens for S3 put events for a specified S3 bucket, retrieves the uploaded image file, creates the thumbnail, and puts them back to the specified S3 bucket’s thumbnails directory while respecting the key structure.