Courseiva
Deployment →easyMultiple Choice

DVA-C02 Deployment Practice Question

A developer is deploying a serverless application using AWS SAM. The developer wants to define a Lambda function that is invoked by an Amazon API Gateway REST API. Which SAM resource type should the developer use to define the API?

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

✓

AWS::Serverless::Api

AWS::Serverless::Api defines an API Gateway REST API in SAM. Option A is wrong because AWS::Serverless::SimpleTable defines a DynamoDB table, not an API. Option C is wrong because AWS::ApiGateway::RestApi is a raw CloudFormation resource, not a SAM shorthand resource type. Option D is wrong because AWS::Serverless::Function defines a Lambda function, not an API.

Answer analysis

Option-by-option breakdown

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

  • ✗

    AWS::Serverless::SimpleTable

    Why it's wrong here

    This AWS Serverless Application Model (SAM) resource is specifically designed to provision an Amazon DynamoDB table, providing a simplified way to define a NoSQL data store for serverless applications. It automatically configures a primary key and can be used for persistent data storage. However, `AWS::Serverless::SimpleTable` does not define an API endpoint or an API Gateway, which is responsible for handling HTTP requests and routing them to backend services.

  • ✓

    AWS::Serverless::Api

    Why this is correct

    This is the correct AWS Serverless Application Model (SAM) resource for defining an Amazon API Gateway REST API within a serverless application. `AWS::Serverless::Api` allows developers to specify API endpoints, methods, and integrations with backend services like AWS Lambda functions. This resource abstracts away much of the underlying CloudFormation complexity required to set up a robust and scalable API Gateway, making it the idiomatic choice for exposing HTTP endpoints.

  • ✗

    AWS::ApiGateway::RestApi

    Why it's wrong here

    This resource is a native AWS CloudFormation type used to define an Amazon API Gateway REST API. While technically capable of creating an API Gateway, it requires more verbose configuration and manual setup of methods and integrations compared to its SAM counterpart. For serverless applications built with SAM, `AWS::Serverless::Api` is the preferred and more concise abstraction, as it simplifies the definition of API Gateway resources significantly.

  • ✗

    AWS::Serverless::Function

    Why it's wrong here

    This AWS Serverless Application Model (SAM) resource is used to define an AWS Lambda function, which serves as the compute component for executing serverless code. It specifies the function's runtime, handler, memory, and environment variables. While a Lambda function is often the backend target for an API Gateway, `AWS::Serverless::Function` itself only defines the compute resource, not the API Gateway endpoint or its routing logic.

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

Courseiva writes every DVA-C02 question from scratch — 1,135 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.