A possible solution to this problem is to use Amazon S3's object metadata and AWS Step Functions to coordinate the file upload and image resizing process. Here's a high-level overview of the system design:

File upload: When a user uploads a file to the S3 bucket, a metadata entry is added to the object that includes a flag indicating that the file has not been processed.

Step Function: The Step Function is triggered by a S3 bucket object creation event, and it contains two states: a Wait state and a Lambda function state.

Wait state: In this state, the Step Function waits for a specified period of time (e.g., 5 minutes) to ensure that the S3 object has finished uploading and is fully available.

Lambda function state: The Lambda function state is responsible for checking the metadata flag on the S3 object. If the flag indicates that the file has not been processed, the Lambda function resizes the file and updates the metadata flag to indicate that the file has been processed. If the flag indicates that the file has already been processed, the Lambda function exits without doing anything.

By using the Step Function's Wait state and S3 object metadata, this system ensures that the Lambda function is only triggered once and that the original file names are preserved.

Note: This is just a high-level overview and further details, such as error handling, may need to be added to the design to ensure a fully functioning system.
spam lang_mismatch quality