SOA-C02 Question 151
Single answerAn organization uses EC2 instances to process data uploaded to an S3 bucket. The SysOps administrator is tasked with automating the workflow so that whenever a file is uploaded to the S3 bucket, the EC2 instance is triggered to process it. Which solution will achieve this automation effectively?
- A
Create an S3 Event Notification to trigger an AWS Lambda function that sends a message to an Amazon SQS queue, which the EC2 instance polls for processing instructions.
- B
Use AWS Systems Manager Automation documents to monitor the S3 bucket and trigger the EC2 instance when a new file is uploaded.
- C
Enable S3 Event Notifications to directly invoke the EC2 instance whenever a new file is uploaded to the bucket.
- D
Set up an Amazon EventBridge rule to monitor S3 file uploads and start the EC2 instance using the AWS CLI.
Show answer and explanation
Correct answer: A
Explanation
The best solution for automating this workflow is to use S3 Event Notifications to trigger a Lambda function, which can send a message to an SQS queue. The EC2 instance can poll the SQS queue for processing instructions. This approach leverages AWS best practices for event-driven architecture by using decoupled components and ensures scalability and reliability in the automation process.
- A. Correct.
This option is correct. S3 Event Notifications can trigger a Lambda function, which can send a message to an SQS queue. The EC2 instance can then poll the SQS queue to retrieve the message and process the file. This is a scalable and decoupled architecture for automating the workflow.
- B. Incorrect.
This option is incorrect. While AWS Systems Manager Automation documents can automate management tasks, they are not designed to monitor S3 bucket events or trigger EC2 instances based on file uploads.
- C. Incorrect.
This option is incorrect. S3 Event Notifications cannot directly invoke an EC2 instance. They can trigger services like Lambda, SQS, or SNS but not EC2 directly.
- D. Incorrect.
This option is incorrect. Amazon EventBridge can monitor S3 events, but it cannot directly start or trigger an EC2 instance without additional steps like invoking Lambda or Systems Manager.