Courseiva
Question 505 of 724
DeploymentmediumMultiple ChoiceObjective-mapped

DVA-C02 Deployment Practice Question

A developer is deploying a new version of a Lambda function using the AWS CLI. The developer wants to shift 10% of traffic to the new version and then gradually increase to 100% over 10 minutes. Which CLI command should the developer use?

⚠ Common exam trap

Candidates often confuse `publish-version` (which only creates a version) with the alias routing command needed to actually shift traffic, or they may think `invoke` can be used for deployment, but only `update-alias` with `--routing-config` enables the weighted traffic shift described in the question.

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 update-alias --function-name my-function --name prod --function-version 2 --routing-config AdditionalVersionWeights={"1":0.9}

The `update-alias` command with the `--routing-config` parameter allows you to implement canary deployments by assigning a percentage of traffic to a new Lambda function version. In this case, `AdditionalVersionWeights={"1":0.9}` routes 10% of traffic to version 2 (the new version) and 90% to version 1. However, note that this command only sets a static routing configuration; to gradually increase traffic to 100% over 10 minutes, you must update the alias multiple times (e.g., via a script) to adjust the weights progressively. The command shown is the correct initial step to start the canary deployment.

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 it's wrong here

    The `aws lambda publish-version` command creates an immutable snapshot of the current Lambda function's code and configuration, assigning it a unique version number. While this makes the new version available for use, it does not automatically direct any invocation traffic to it. To deploy this new version and shift traffic, an alias must be explicitly updated to point to it, or traffic routing configured through an alias.

  • 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 to provision an entirely new AWS Lambda function, requiring a unique name and an initial code package. This operation does not update an existing function's code or configuration, nor does it create a new version of an already deployed function. Deploying a new version specifically refers to updating an *existing* function, typically using `update-function-code` followed by `publish-version` or directly updating an alias.

  • aws lambda update-alias --function-name my-function --name prod --function-version 2 --routing-config AdditionalVersionWeights={"1":0.9}

    Why this is correct

    This command precisely implements a canary deployment strategy by updating the `prod` alias. It configures the alias to direct 10% of the invocation traffic (calculated as 1.0 minus the specified `AdditionalVersionWeights` for the older version, 0.9) to the newly specified `function-version 2`. The remaining 90% of traffic continues to serve `version 1`, allowing for gradual rollout and monitoring of the new version before a full cutover.

  • aws lambda invoke --function-name my-function --payload '{}'

    Why it's wrong here

    The `aws lambda invoke` command is solely used to execute a Lambda function on demand, passing a specific payload as input to trigger its execution. Its purpose is to test the function's runtime behavior or to programmatically trigger it, not to modify its code, configuration, or deployment strategy. This command plays no role in the deployment process of a new function version.

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 creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.