Courseiva
DeploymenteasyMultiple ChoiceObjective-mapped

DVA-C02 Deployment Practice Question

A developer is using the AWS CLI to deploy a new version of a Lambda function. The developer runs the following command:

aws lambda update-function-code --function-name my-function --zip-file fileb://my-code.zip

After the command completes, the developer checks the function and sees that the code has been updated but the version number is still $LATEST. The developer wants to create a new version so that the previous version is preserved. What should the developer do next?

⚠ Common exam trap

Many exam-takers assume the `update-function-code` command automatically creates a new version, but it only updates `$LATEST` unless the `--publish` flag is explicitly used, leading them to incorrectly choose Option A or D.

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

Run the publish-version command to create a new version from the updated $LATEST.

The `update-function-code` command without the `--publish` flag only updates the `$LATEST` version of the Lambda function. To create an immutable, numbered version that preserves the previous code, the developer must explicitly run the `publish-version` command, which takes the current `$LATEST` code and publishes it as a new version (e.g., version 2). This ensures the previous version (version 1) remains unchanged and can be referenced via its version ARN.

Answer analysis

Option-by-option breakdown

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

  • Run the update-function-code command again with the --publish flag.

    Why it's wrong here

    The update-function-code command, when executed without the --publish flag, updates only the $LATEST version of the Lambda function. Running it again with --publish would overwrite $LATEST again with potentially the same code and then publish that as a new version. The goal is to publish the already updated $LATEST as a new version, not to re-update and then publish. The --publish flag is specifically for publishing at the time of the code update, not for publishing a previously updated $LATEST.

  • Run the delete-function command and then create-function with the updated code.

    Why it's wrong here

    Deleting the function entirely with delete-function and then recreating it with create-function would result in a completely new function ARN, effectively erasing all existing versions, aliases, triggers, and associated configurations. This drastic action is not an appropriate or efficient method for simply creating a new version of an existing function. Lambda versioning is specifically designed to manage multiple code deployments for the same function without requiring a full recreation, preserving its identity and history.

  • Run the publish-version command to create a new version from the updated $LATEST.

    Why this is correct

    The publish-version command is the precise and correct mechanism to create an immutable, numbered version of a Lambda function based on the current state of its $LATEST qualifier. Since the developer has already successfully updated the function's code (which implicitly updates $LATEST), this command will capture that specific, updated code as a new, distinct version. This new version can then be referenced by aliases, enabling controlled deployments and reliable rollbacks.

  • Run the update-function-configuration command to set the version number.

    Why it's wrong here

    The update-function-configuration command is exclusively used to modify various configuration settings of an existing Lambda function, such as memory allocation, timeout duration, environment variables, or the execution role. It does not possess any functionality or parameters to create new versions of the function or to directly "set" a version number. Version numbers are automatically generated and assigned by Lambda only when a new version is explicitly published, not through configuration updates.

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.