DVA-C02 exam dumps

DVA-C02 practice question 360 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 360

Single answer

You are developing a serverless application using AWS Lambda. The application processes records from an Amazon S3 bucket in real-time. You are tasked with ensuring that your Lambda function only processes objects that are uploaded to a specific folder within the bucket. How can you achieve this?

  1. A

    Use an S3 event notification with a prefix filter for the specific folder and configure it to trigger the Lambda function.

  2. B

    Add a filter condition in the Lambda function code to skip records that do not belong to the specific folder.

  3. C

    Configure an Amazon EventBridge rule to trigger the Lambda function when objects are uploaded to the specific folder.

  4. D

    Set an IAM policy on the S3 bucket to allow access to the Lambda function only for objects in the specific folder.

Show answer and explanation

Correct answer: A

Explanation

To ensure that a Lambda function processes only objects uploaded to a specific folder within an S3 bucket, you can use S3 event notifications with a prefix filter. This approach is efficient and prevents unnecessary Lambda function invocations for unrelated uploads. Other options, such as filtering in the Lambda function or using EventBridge, are either inefficient or unsuitable for this scenario.

  • A. Correct.

    This is the correct answer. S3 event notifications support prefix and suffix filters that allow you to trigger a Lambda function for objects that meet specific naming patterns, such as a folder prefix.

  • B. Incorrect.

    This is incorrect. While you can add this logic in the Lambda function code, it is less efficient because the Lambda function would still be triggered for all uploads, leading to unnecessary invocations and higher costs.

  • C. Incorrect.

    This is incorrect. Amazon EventBridge does not natively support filtering S3 object creation events based on folder prefixes. S3 event notifications are the appropriate solution here.

  • D. Incorrect.

    This is incorrect. IAM policies control access to resources but cannot be used to trigger Lambda functions based on specific S3 object prefixes.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam