Here's one possible design for a system that uploads a file to S3 and resizes it using AWS Lambda, without triggering the resize Lambda function multiple times:

The user uploads a file to an S3 bucket.
S3 generates a "Put Object" event and triggers a Lambda function.
The Lambda function checks if the uploaded file has already been resized by checking if the resized file exists in the same S3 bucket with the same key but a different file extension (e.g. ".resized").
If the resized file exists, the Lambda function returns without doing anything further.
If the resized file does not exist, the Lambda function reads the original file from S3, performs the resize operation, and writes the resized file back to S3 with the same key but with a different file extension.
The Lambda function updates the metadata of the original file in S3 with a flag indicating that the file has been resized.
This design ensures that the Lambda function is only triggered once for each uploaded file, and that the resized file is stored in the same S3 bucket with the same key as the original file, making it easier to keep track of the resized files.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence