Courseiva
Development with AWS ServicesmediumMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A developer is creating a REST API using Amazon API Gateway with Lambda proxy integration. The API needs to accept and return binary data such as images or PDF files. The developer has configured the API to use the Lambda proxy integration. What additional configuration is required to support binary data?

⚠ Common exam trap

Test-takers frequently assume Lambda proxy integration automatically handles binary data because it passes everything through, but in reality, API Gateway requires explicit binary media type configuration to avoid corrupting binary payloads during base64 encoding/decoding.

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

In API Gateway, add the binary media types to the API settings, e.g., image/png, application/pdf.

With Lambda proxy integration, API Gateway passes the client request as-is to Lambda and returns the Lambda response as-is to the client. To handle binary data, you must explicitly declare the binary media types (e.g., image/png, application/pdf) in the API Gateway REST API settings. This tells API Gateway to base64-encode the binary payload before sending it to Lambda and to decode the base64-encoded response from Lambda back to binary for the client. Without this configuration, API Gateway treats all payloads as text and will corrupt binary data.

Answer analysis

Option-by-option breakdown

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

  • Set the Content-Type header to application/octet-stream in the Lambda response.

    Why it's wrong here

    While setting the Content-Type header in the Lambda response is a crucial step to inform the client about the data type, it is insufficient on its own for API Gateway to correctly handle binary data. Without explicit configuration in API Gateway to recognize `application/octet-stream` as a binary media type, API Gateway will treat the Lambda response body as a UTF-8 string. This often results in the binary data being incorrectly base64-encoded or corrupted during transit, preventing proper rendering by the client.

  • In API Gateway, add the binary media types to the API settings, e.g., image/png, application/pdf.

    Why this is correct

    This is the correct and essential step for API Gateway to properly handle binary data from a Lambda integration. By explicitly listing media types like `image/png` or `application/pdf` in the API Gateway's binary media types settings, you instruct API Gateway to treat incoming and outgoing payloads of these types as raw binary data. This ensures that API Gateway correctly base64-encodes binary responses from Lambda before sending them to the client and decodes binary requests before passing them to Lambda, preventing data corruption.

  • Use an API Gateway custom domain with an SSL certificate.

    Why it's wrong here

    Using an API Gateway custom domain with an SSL certificate enhances the API's branding and provides secure, encrypted communication (HTTPS) between clients and the API Gateway endpoint. While crucial for production APIs, this configuration is entirely unrelated to how API Gateway processes or transmits binary data payloads. It addresses the API's public URL and transport-level security, not the content type handling mechanism.

  • Enable API caching with binary support.

    Why it's wrong here

    Enabling API caching is designed to improve API performance and reduce the load on backend integrations by storing responses for subsequent identical requests. While API Gateway caching can indeed store binary responses once they are correctly configured and processed as binary, the caching mechanism itself does not enable or configure the fundamental ability for API Gateway to recognize and handle binary media types. Binary support must be established independently through the API's settings.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

This DVA-C02 question is part of Courseiva's 724-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.