Courseiva
DeploymenteasyMultiple ChoiceObjective-mapped

DVA-C02 Deployment Practice Question

A developer is deploying a serverless application using the AWS Serverless Application Model (SAM). The application consists of an API Gateway endpoint and an AWS Lambda function. The developer wants to define a stage name for the API Gateway deployment. Which section of the SAM template should the developer use?

⚠ Common exam trap

Many exam-takers think stage names must be defined directly on the API Gateway resource (e.g., under `Properties` of `AWS::Serverless::Api`), but the `Globals` section is the correct and more efficient way to set shared API Gateway properties like `StageName` across the entire template.

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

Globals

The `Globals` section in an AWS SAM template allows you to define shared configuration settings that apply to all resources in the template. For API Gateway, you can set properties like `StageName` under `Globals.Api`, which will be inherited by all API Gateway resources defined in the template, ensuring consistent stage naming without repeating the configuration.

Answer analysis

Option-by-option breakdown

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

  • Globals

    Why this is correct

    The `Globals` section in an AWS SAM template is specifically designed to define common properties that apply to all resources of a particular type within the template. For API Gateway resources, setting `Api.StageName` within the `Globals` section ensures that every API defined in the template will automatically use the specified stage name. This approach centralizes the configuration, making it efficient for a developer to apply a consistent stage name across all APIs in a serverless application.

  • Conditions

    Why it's wrong here

    AWS CloudFormation `Conditions` are used to control whether resources are created or properties are applied based on a logical evaluation that resolves to true or false during stack deployment. They enable conditional resource provisioning, such as deploying a resource only in a specific environment. However, `Conditions` do not directly set or modify resource properties like an API Gateway stage name; their purpose is to determine inclusion or exclusion, not to assign values.

  • Outputs

    Why it's wrong here

    The `Outputs` section in an AWS CloudFormation template is used to declare values that can be easily retrieved after the stack is created, or referenced by other CloudFormation stacks. These outputs provide a mechanism to export information about the deployed resources, such as an API endpoint URL or a resource ARN, for external consumption. `Outputs` are purely for exposing stack information post-deployment and are not used for configuring or setting deployment-time properties like an API Gateway stage name.

  • Parameters

    Why it's wrong here

    AWS CloudFormation `Parameters` allow you to input custom values to your template each time you create or update a stack, enhancing template reusability. While a parameter could define a stage name, it would then need to be explicitly referenced by each API resource or within the `Globals` section to be applied. `Parameters` themselves are input variables, not a direct mechanism for universally applying a stage name across all APIs without further explicit configuration within the resource definitions or the `Globals` section.

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

One of 724 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.