Courseiva
DeploymenteasyMultiple ChoiceObjective-mapped

DVA-C02 Deployment Practice Question

A developer is deploying a new version of a Lambda function using the AWS CLI. The function is part of a serverless application that processes S3 events. The developer wants to ensure that the new version is production-ready and that the old version is still available for rollback. Which CLI command should the developer use to create a new version of the Lambda function?

⚠ Common exam trap

A common mix-up: candidates confuse deploying code with `update-function-code` (which only updates $LATEST) with publishing a new version, assuming that any code update automatically creates a version; in reality, you must explicitly run `publish-version` to create an immutable, numbered version for production use and rollback.

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 lambda publish-version --function-name my-function

The `aws lambda publish-version` command creates an immutable, versioned snapshot of the Lambda function's code and configuration, which is required for production-ready deployments. This ensures the old version remains available for rollback while the new version is published with a unique version number (e.g., $LATEST, 1, 2). The command explicitly publishes the current $LATEST version as a new numbered version, making it production-ready without affecting existing versions.

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 lambda publish-version --function-name my-function

    Why this is correct

    The `aws lambda publish-version` command is the correct method to create an immutable snapshot of a Lambda function's code and configuration. This action assigns a unique, sequential version number to the current state of the `$LATEST` function, making it available for consistent invocation, rollbacks, and integration with aliases for controlled deployments. It explicitly captures the function's current definition.

  • aws lambda update-function-configuration --function-name my-function --handler new-handler

    Why it's wrong here

    The `aws lambda update-function-configuration` command modifies specific settings, such as the handler, memory, or timeout, for the `$LATEST` version of a Lambda function. While it changes the function's operational parameters, it does not automatically create a new, immutable version. To preserve these configuration changes as a distinct version, a subsequent `publish-version` command would be required.

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

    Why it's wrong here

    The `aws lambda update-function-code` command deploys new code to the `$LATEST` version of a Lambda function, updating its implementation. By default, this action only modifies the mutable `$LATEST` version and does not automatically create a new, immutable version. To publish a new version concurrently with the code update, the `--publish` flag must be explicitly included in this command.

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

    Why it's wrong here

    The `aws lambda create-function` command is used for the initial provisioning of an entirely new Lambda function. It requires a unique function name and an initial code package. This command does not interact with existing functions or their versions; its purpose is to establish a new function resource, not to iterate on or version an already deployed one.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

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.