AWS Certified Developer Associate DVA-C02 Practice Question

A developer is building a new AWS Lambda function using Python. The function is triggered by Amazon S3 object-creation events and contains complex business logic that needs to be validated. The developer needs to write repeatable tests that verify only the function's core logic without making actual calls to other AWS services. What is the MOST effective approach for unit testing this function's logic?

  • Write an AWS CLI script to invoke the deployed Lambda function, passing a base64-encoded S3 event as the payload.

  • Use the AWS SAM CLI command sam local invoke with a sample S3 event JSON file to run the function in a local Docker container.

  • Mock the S3 event and AWS SDK clients, and then invoke the Lambda handler function directly with the mock event.

  • Deploy the function to a development environment and upload a test object to the S3 bucket to trigger an invocation.

AWS Certified Developer Associate DVA-C02
Development with AWS Services
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot