DVA-C02 Development with AWS Services Practice Question
A developer is creating a CI/CD pipeline for a serverless application using AWS CodePipeline. The application consists of an AWS Lambda function, an Amazon API Gateway REST API, and an Amazon DynamoDB table. Which action should the developer take to automate the deployment of the API Gateway updates?
⚠ Common exam trap
It's easy for candidates to assume CodeBuild or a custom Lambda function is needed for deployment, but the exam tests whether you recognize that CloudFormation is the native, fully managed IaC service that integrates seamlessly with CodePipeline for deploying API Gateway updates.
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 AWS CloudFormation to define and deploy the API Gateway.
AWS CloudFormation provides infrastructure as code (IaC) capabilities that allow you to define the entire API Gateway configuration, including resources, methods, integrations, and deployment stages, in a template. When integrated with CodePipeline, CloudFormation can automatically create or update the API Gateway and trigger a deployment as part of the CI/CD pipeline, ensuring consistent and repeatable deployments without manual intervention.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use AWS Lambda to update the API Gateway configuration.
Why it's wrong here
While AWS Lambda can programmatically interact with API Gateway's control plane via the AWS SDK, directly using Lambda for deployments in a CI/CD pipeline is not an Infrastructure as Code (IaC) best practice. This approach lacks declarative state management, versioning, and robust rollback capabilities inherent to IaC tools like CloudFormation, making deployments less reliable, harder to audit, and prone to configuration drift.
- ✗
Store the API Gateway Swagger file in Amazon S3 and trigger a deployment.
Why it's wrong here
Storing a Swagger/OpenAPI definition file in Amazon S3 is a valid practice for artifact storage and versioning within a CI/CD pipeline. However, S3 itself is solely an object storage service and does not possess the inherent capability to interpret or deploy an API Gateway configuration. An additional service, such as AWS CloudFormation or a script executing AWS CLI commands, would be required to read the definition from S3 and apply it to create or update the API Gateway.
- ✓
Use AWS CloudFormation to define and deploy the API Gateway.
Why this is correct
AWS CloudFormation is the recommended and most robust service for defining and deploying AWS resources, including API Gateway, as Infrastructure as Code (IaC). It allows developers to declaratively specify the entire API Gateway configuration in a template, enabling automated, repeatable, and version-controlled deployments with built-in rollback capabilities, which is crucial for maintaining consistency and reliability in CI/CD pipelines.
- ✗
Use AWS CodeBuild to compile and deploy the API Gateway configuration.
Why it's wrong here
AWS CodeBuild is primarily a fully managed continuous integration service designed for compiling source code, running tests, and producing deployable artifacts. While CodeBuild can execute arbitrary commands, including AWS CLI commands to interact with API Gateway, its core purpose is *building* and testing, not orchestrating the declarative deployment of infrastructure. Direct infrastructure deployment is better handled by orchestration services like AWS CodePipeline or dedicated IaC tools like CloudFormation, which CodeBuild might invoke as part of a larger pipeline.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
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 →
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.