Trigger Fargate tasks from S3 with a Lambda container-selection function
Short answer
C Move uploads to S3, use a Lambda function to pick and start the Fargate task, and invoke it from an S3 object-created notification.
Question
Key Takeaways
EFS does not emit events that EventBridge rules can match, so the file-upload trigger has to move to S3 object-created notifications, and because a two-hour job exceeds the Lambda limit the execution itself must stay in ECS Fargate tasks while Lambda only makes the routing decision.
An application on EC2 polls an EFS file system for new files, picks a Docker image per file, and runs it as a container that can take up to two hours before writing results back to EFS. The company wants to remove the EC2 instances that run the containers while keeping the per-file container selection logic.
Common mistake: Trying to trigger on EFS directly. EFS has no event notification capability analogous to an S3 object-created notification, so neither an EventBridge rule nor an EFS event notification can start the processing when a file appears, which rules out both the EFS-based options.
Expert Analysis
Why the Answer Is Correct
The processing takes up to two hours, which exceeds the maximum duration of a Lambda function, so the containerised work must run as Amazon ECS Fargate tasks rather than in Lambda. That leaves the selection logic, which is a fast decision, as a Lambda function that inspects the new file and starts the appropriate Fargate task. For the trigger, the storage moves to Amazon S3 because S3 emits an object-created event notification that can invoke the Lambda function directly, and the processing code is updated to read and write S3 instead of EFS. This removes the EC2 instances entirely, since Fargate runs the tasks and Lambda runs the decision, both serverless.
Why the Other Options Are Wrong
A: An EventBridge rule cannot be configured to run when files are added to an EFS file system, because EFS does not publish events that EventBridge patterns can match, so the trigger would never fire. B: EFS likewise has no event notification feature, so the proposed EFS event notification to invoke the Fargate service does not exist, and a Fargate service is a long-running service rather than a per-file decision maker. D: Lambda container images are subject to the same maximum execution duration as any Lambda function, so a processing job that can take two hours cannot run in Lambda, which makes this option unable to meet the processing requirement.
Community Comment Notes
The community voted 100 to 0 for C, and the top comments identified the decisive constraint from two directions. One noted that EventBridge cannot monitor EFS events, which eliminates A, and another observed that EFS has no event notification like S3, which eliminates B. A further commenter added the other half of the reason, that Lambda cannot perform two-hour container execution, which rules out D.
Official Reference
https://docs.aws.amazon.com/lambda/latest/dg/with-s3.html
This link opens the official vendor documentation in a new tab.
Community Votes
100% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 5 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 5
-
mark_232323 👍 3 Answered CEFS event notification to invoke the Fargate --> EFS don't have event notification like s3
-
kupo777 👍 3C EFS cannot notify events and Lambda cannot do container execution for 2 hours.
-
vip2 👍 3 Answered CC EventBridge can not monitor EFS event directly, not A
-
0b43291 👍 2 Answered CBy combining Amazon ECS with Fargate tasks, AWS Lambda for the container selection logic, and Amazon S3 for event-driven processing, Option C provides a serverless and scalable solution that meets the requirements while minimizing the need for EC2 instances and leveraging the strengths of each AWS service. While this solution requires migrating the file storage from Amazon EFS to Amazon S3, it addresses the requirement of eliminating EC2 instances by leveraging AWS Fargate for the processing tasks and AWS Lambda for the container selection logic. Additionally, it utilizes the event notification capabilities of Amazon S3 to trigger the Lambda function when new files are uploaded. The other options are either not feasible due to the limitations of Amazon EFS (Options A and B) or introduce additional constraints by using AWS Lambda for the long-running data processing tasks (Option D).
-
mkgiz 👍 1 Answered CEFS event notification to invoke the Fargate
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All SAP-C02 Questions
Access 85 questions with complete answers and detailed explanations.
View Full SAP-C02 Practice Test →