Courseiva
Development with AWS ServicesmediumMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A company wants to build a RESTful API that handles file uploads. The API needs to support multipart/form-data content type. The developer is using Amazon API Gateway and AWS Lambda. Which approach should the developer use to handle file uploads efficiently?

⚠ Common exam trap

Candidates often assume Lambda can handle file uploads directly via API Gateway, overlooking the 10 MB payload limit and 29-second timeout, and fail to recognize the presigned URL pattern as the efficient serverless solution for large multipart/form-data uploads.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Use API Gateway to generate a presigned S3 URL, and have the client upload directly to S3. The Lambda function can then process the file asynchronously.

It offloads the file upload to Amazon S3 directly via a presigned URL, which avoids the 10 MB payload limit and 29-second timeout of API Gateway and Lambda for large files. The client uploads the file to S3, and a separate Lambda function processes the file asynchronously, making the solution efficient and scalable for multipart/form-data uploads.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Configure API Gateway to pass the entire request body to Lambda, and process the file within the Lambda function.

    Why it's wrong here

    This approach is unsuitable for handling file uploads due to strict payload size limitations. Amazon API Gateway has a maximum request body size of 10 MB, and AWS Lambda has a synchronous invocation payload limit of 6 MB. Any file exceeding these relatively small thresholds would cause the API Gateway or Lambda invocation to fail, making it impractical for typical file upload scenarios.

  • Create a Lambda function that accepts the file and uploads it to S3 using the AWS SDK.

    Why it's wrong here

    While a Lambda function can upload to S3 using the AWS SDK, this option still faces the fundamental constraint of Lambda's invocation payload size. For synchronous invocations, the maximum payload size is 6 MB. If the Lambda function is directly receiving the file as part of its input payload, it cannot accept files larger than this limit, making it an unscalable solution for larger file uploads.

  • Use API Gateway to generate a presigned S3 URL, and have the client upload directly to S3. The Lambda function can then process the file asynchronously.

    Why this is correct

    This is the recommended serverless pattern for large file uploads. API Gateway can authenticate the request and then generate a temporary, time-limited presigned URL for S3. The client then uses this URL to upload the file directly to S3, bypassing API Gateway and Lambda payload limits entirely. S3 can then asynchronously trigger a Lambda function (e.g., via S3 event notifications) to process the uploaded file, ensuring scalability and efficiency.

  • Use an EC2 instance to host a custom web server that accepts file uploads and writes to S3.

    Why it's wrong here

    Using an EC2 instance for file uploads bypasses the specified Amazon API Gateway and AWS Lambda architecture, failing to leverage the serverless components for the core upload mechanism. This approach introduces an entirely separate compute layer for handling `multipart/form-data`, which contradicts the question's premise of using API Gateway and Lambda. However, hosting a custom web server on EC2 is a valid and common strategy for handling large file uploads when direct control over server resources and custom processing logic is paramount, or when the serverless payload limits are a constraint for the *entire* request.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

Courseiva writes every DVA-C02 question from scratch — 724 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.