SOA-C03 practice question 10 of 10

A company runs a website on Amazon EC2 instances. Users can upload images to an Amazon S3 bucket and publish the images to the website. The company…

Full set: 219 questions

Domain Deployment, Provisioning, and Automation

A company runs a website on Amazon EC2 instances. Users can upload images to an Amazon S3 bucket and publish the images to the website. The company wants to deploy a serverless image- processing application that uses an AWS Lambda function to resize the uploaded images. The company's development team has created the Lambda function. A CloudOps engineer must implement a solution to invoke the Lambda function when users upload new images to the S3 bucket. Which solution will meet this requirement?
Answer options
A: Configure an Amazon Simple Notification Service (Amazon SNS) topic to invoke the Lambda function when a user uploads a new image to the S3 bucket.
B: Configure an Amazon CloudWatch alarm to invoke the Lambda function when a user uploads a new image to the S3 bucket.
C: Configure S3 Event Notifications to invoke the Lambda function when a user uploads a new image to the S3 bucket. Correct answer
D: Configure an Amazon Simple Queue Service (Amazon SQS) queue to invoke the Lambda function when a user uploads a new image to the S3 bucket.
Correct Answer:
C. Configure S3 Event Notifications to invoke the Lambda function when a user uploads a new image to the S3 bucket.
Explanation

The most direct and efficient method to meet the requirement is to use Amazon S3 Event Notifications. This feature is designed to enable event-driven computing by sending a notification to a destination when a specific event, such as an object creation (s3:ObjectCreated:), occurs in an S3 bucket. AWS Lambda is a natively supported destination for these notifications. Configuring an S3 event notification to target the Lambda function creates a direct, serverless invocation pattern without unnecessary intermediate services, providing a low-latency and cost-effective solution.

Why Incorrect

A. This is a valid but indirect pattern. It introduces an unnecessary component (SNS), adding latency and complexity compared to the direct S3-to-Lambda invocation.
B. Amazon CloudWatch Alarms are used to trigger actions based on metrics crossing a defined threshold, not for discrete events like an object upload.
D. This is also a valid but indirect pattern. While useful for decoupling and throttling, adding an SQS queue is not required for the simple invocation described. ---

References

1. AWS Lambda Developer Guide: In the section "Using AWS Lambda with Amazon S3," the documentation states, "You can use Amazon S3 to trigger a Lambda function to process object-created events. You can configure the S3 trigger in the Lambda console to create an S3 event notification that invokes your function." This confirms the direct integration. (Source: AWS Lambda Developer Guide, "Using AWS Lambda with Amazon S3").

2. Amazon S3 User Guide: The documentation on "Amazon S3 Event Notifications" lists the supported destinations for events. It explicitly includes "AWS Lambda function" as a destination. This highlights that a direct invocation is the intended design pattern. (Source: Amazon S3 User Guide, "Amazon S3 Event Notifications," section "Event notification destinations").

3. Amazon S3 User Guide: The guide further details the process in "Walkthrough: Using an S3 trigger to invoke a Lambda function." This walkthrough provides a step-by-step implementation of the exact scenario described in the question, reinforcing that S3 Event Notifications are the correct mechanism. (Source: Amazon S3 User Guide, "Tutorials and examples," section "Walkthrough: Using an S3 trigger to invoke a Lambda function").

4. Amazon CloudWatch User Guide: The documentation for "Using Amazon CloudWatch alarms" specifies that "You can create an alarm that watches a single CloudWatch metric... The alarm performs one or more actions based on the value of the metric... relative to a threshold over a number of time periods." This confirms alarms are for metric-based state changes, not event-based triggers. (Source: Amazon CloudWatch User Guide, "Using Amazon CloudWatch alarms").

Question breakdown

Tests
Implement event-driven invocation from Amazon S3
Difficulty
Easy

Key idea: S3 Event Notifications can invoke a Lambda function directly on object-created events, with no intermediary service required.

How to reach the answer

  1. The trigger is an object upload to an S3 bucket.
  2. S3 Event Notifications support Lambda as a native destination for s3:ObjectCreated events.
  3. SNS or SQS would only help if fan-out or buffering were required, and neither is mentioned.
  4. CloudWatch alarms respond to metric thresholds, not individual object events.

Each option

  • AIncorrect. SNS can be placed in the path, but it still needs S3 notifications as the source and adds an unneeded hop.
  • BIncorrect. CloudWatch alarms evaluate metric thresholds and do not fire on individual object uploads.
  • CCorrect. S3 Event Notifications invoke the Lambda function directly when new objects are created.
  • DIncorrect. An SQS queue adds buffering that the requirement does not call for and still depends on S3 notifications to receive events.

Common trap: SNS and SQS are familiar decoupling services, so they seem necessary, but S3 can call Lambda directly.

In practice: Thumbnail generation, file validation and metadata extraction pipelines are commonly built on S3 notifications that trigger Lambda, optionally filtered by prefix or suffix.

Remember: For 'run code when an object is uploaded', configure an S3 Event Notification with Lambda as the destination.

Reviewed by David Mercer.

Keep practicing

Take the free SOA-C03 practice test

Ten exam-style questions with answers and explanations, plus the exam facts and study guides.

Start the free practice test

More questions

Other SOA-C03 practice questions

Scroll to Top