An application running on EC2 polls an Amazon EFS file system for new files. When a new file appears, the app selects a Docker container image to process the file, starts the appropriate container, and passes the file location. Processing can take up to 2 hours; when finished, the container writes the result back to EFS and exits. The company wants to remove the EC2 instances that run these containers. Which refactoring approach meets the requirement?
Choose an answer
Tap an option to check your answer.
Correct answer: Create an Amazon ECS cluster and run the processing as AWS Fargate tasks. Extract the container selection logic into an AWS Lambda function that starts the appropriate Fargate task. Move file storage to an Amazon S3 bucket, update processing code to use S3, and configure an S3 event notification to invoke the Lambda function on object creation..
Why this is the answer
The correct approach leverages Amazon S3 for event-driven processing and Fargate for long-running containerized tasks. S3 object creation events reliably trigger a Lambda function, which can then implement the container selection logic and launch an appropriate Fargate task. Fargate is ideal for tasks up to 2 hours, fitting the processing requirement. EFS does not natively support event notifications for file creation, making direct EFS triggers difficult. While Lambda can run container images, its 15-minute timeout is insufficient for 2-hour processing. ECS on EC2 would require managing EC2 instances, which the company wants to avoid.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed