Skip to main content

DVA-C02 · 18% of the exam

Troubleshooting and Optimization practice questions

10 free Troubleshooting and Optimization questions for the AWS Certified Developer – Associate (DVA-C02) exam, each with the correct answer and an explanation for every option.

What this domain covers

Finding and fixing problems in running applications and making them faster or cheaper: logging, tracing, metrics and tuning.

Exam weight
18%
On a real exam
≈ 12 questions
In our bank
120 questions

Topics that come up most

  • CloudWatch Logs, metrics and alarms
  • X-Ray tracing and service maps
  • Lambda memory, timeout and cold starts
  • DynamoDB throttling and hot partitions
  • Caching strategies

How to study it

For every error a question describes, ask which log, metric or trace would show it. Most answers are 'look here first'.

Sample Troubleshooting and Optimization questions

Try each one before opening the answer. Original questions written to the official exam objectives.

  1. Question 1

    A developer deploys an API Gateway REST API to a stage named prod. The GET /orders method has authorization set to NONE and doesn't require an API key. A client sends GET https://abc123.execute-api.us-east-1.amazonaws.com/orders and gets a 403 response whose message is "Missing Authentication Token". What is the most likely cause?

    • AThe URL leaves out the stage name, so the request doesn't match any deployed resource and method
    • BThe client didn't include the x-api-key header that every REST API stage needs
    • CAPI Gateway lacks the resource-based permission it needs to invoke the backend Lambda function
    • DThe client didn't sign the request with Signature Version 4 credentials before sending it
    Show answer and explanation

    Answer: A) The URL leaves out the stage name, so the request doesn't match any deployed resource and method

    In REST APIs, API Gateway returns 403 "Missing Authentication Token" both for missing credentials and when a request doesn't match a deployed resource and method. A common cause is a URL that leaves out the stage name.

    • ACorrect. API Gateway returns the MISSING_AUTHENTICATION_TOKEN gateway response (default status 403) when a client calls an unsupported resource or method. Without /prod in the path, the request doesn't route to the deployed GET /orders method, even though the method needs no authentication.
    • BIncorrect. A REST API requires an API key only on methods where API key required is enabled, and this method doesn't have it enabled. A missing or invalid key on such a method would also be reported as an API key error, not as this routing response.
    • CIncorrect. The request never matched a method, so API Gateway never reached the integration. A missing invoke permission would show up as an integration or server-side error once the method was actually reached.
    • DIncorrect. SigV4 signing is needed only for methods that use IAM (AWS_IAM) authorization. This method's authorization is NONE, so leaving the request unsigned isn't the cause here.
  2. Question 2

    A team wants to detect when its public REST API becomes slow or starts returning errors, before customers report it. This includes overnight periods when almost no customers are using the API. They want scripted requests that follow customer workflows and are sent to the endpoint on a regular schedule. Which AWS capability meets this requirement?

    • AAmazon CloudWatch Synthetics canaries that run scripted checks against the API on a schedule
    • BAmazon CloudWatch RUM app monitors that collect performance data from client sessions
    • CAWS X-Ray active tracing that records segments for requests reaching the API
    • DAmazon CloudWatch Logs metric filters that count error entries in the API's access logs
    Show answer and explanation

    Answer: A) Amazon CloudWatch Synthetics canaries that run scripted checks against the API on a schedule

    CloudWatch Synthetics canaries run scheduled scripts that imitate customer actions against endpoints, so they find availability and latency problems even when there is no real traffic. RUM, X-Ray, and log metric filters only observe traffic that real users have already generated.

    • ACorrect. Canaries are configurable scripts that run on a schedule, as often as once per minute. They follow the same routes and perform the same actions as a customer, check the availability and latency of endpoints, and publish CloudWatch metrics that alarms can watch. Because they generate their own traffic, they work even when there is no customer traffic.
    • BIncorrect. CloudWatch RUM collects client-side data from actual user sessions. It needs real users to produce data, so it can't detect problems during quiet periods or before customers run into them.
    • CIncorrect. X-Ray traces requests that the application actually receives, which helps diagnose latency and errors. It does not generate scheduled, scripted requests, so with no traffic there is nothing to trace.
    • DIncorrect. Metric filters turn log entries that already exist into metrics. They only react to errors that real requests have produced, so they can't proactively test the endpoint when there is no traffic.
  3. Question 3

    A client application calls an AWS Lambda function URL with a plain HTTPS request and receives a 403 Forbidden response. The function runs successfully when tested directly in the Lambda console. Which configuration is a likely cause?

    • AThe function URL uses the AWS_IAM auth type, and the client's requests are not signed with SigV4 using credentials that are allowed to invoke the URL.
    • BThe function's execution role lacks the lambda:InvokeFunctionUrl permission, so the function URL can't pass incoming requests to the function code.
    • CThe function URL was created on an alias rather than the unqualified function, and Lambda rejects requests sent to alias-based URLs.
    • DThe function's reserved concurrency is set too low, so Lambda refuses requests that it can't immediately assign to an execution environment.
    Show answer and explanation

    Answer: A) The function URL uses the AWS_IAM auth type, and the client's requests are not signed with SigV4 using credentials that are allowed to invoke the URL.

    A 403 from a function URL is an authorization failure. With AuthType AWS_IAM, unsigned or improperly signed requests are rejected. Even with AuthType NONE, a resource-based policy that doesn't grant lambda:InvokeFunctionUrl and lambda:InvokeFunction also returns 403.

    • ACorrect. With AuthType AWS_IAM, every request must be signed with AWS Signature Version 4, and the caller needs lambda:InvokeFunctionUrl and lambda:InvokeFunction permissions. Lambda processes the request only if the signatures match, so unsigned requests are rejected before the function code runs.
    • BIncorrect. The execution role controls what the function can do when it runs. Permission to invoke a function URL is checked against the caller, through the caller's identity-based policy and/or the function's resource-based policy, not the execution role.
    • CIncorrect. A function URL can point to an alias or to the unqualified function. Attaching it to an alias doesn't cause requests to be rejected as unauthorized.
    • DIncorrect. Running out of concurrency causes throttling errors, not an authorization failure. It also wouldn't explain a consistent 403 for a client that is simply calling the URL.
  4. Question 4

    A developer uses the AWS CLI to set an AWS Lambda function's tracing mode to Active. The function runs normally and writes logs to Amazon CloudWatch Logs, but no traces for it appear in the AWS X-Ray console. What is the most likely cause?

    • AThe function's execution role doesn't allow xray:PutTraceSegments and xray:PutTelemetryRecords, so Lambda can't upload the trace data it generates.
    • BThe function code doesn't import the X-Ray SDK, which Lambda requires before it records any segments for invocations of the function.
    • CThe X-Ray sampling rate for Lambda functions defaults to zero, so no requests are traced until the developer configures a sampling rule.
    • DThe function isn't attached to a VPC, and X-Ray can collect trace data only from Lambda functions that run inside a VPC.
    Show answer and explanation

    Answer: A) The function's execution role doesn't allow xray:PutTraceSegments and xray:PutTelemetryRecords, so Lambda can't upload the trace data it generates.

    Active tracing makes Lambda generate trace segments, but the execution role still needs xray:PutTraceSegments and xray:PutTelemetryRecords (for example, through AWSXRayDaemonWriteAccess) to deliver them. The console adds these permissions automatically; the CLI and API don't.

    • ACorrect. Lambda needs xray:PutTraceSegments and xray:PutTelemetryRecords in the function's execution role to send trace data (both are in the AWSXRayDaemonWriteAccess managed policy). Lambda adds these permissions automatically only when tracing is turned on in the console, so enabling it through the CLI can leave them missing.
    • BIncorrect. With Active tracing, Lambda automatically creates trace segments for function invocations. The X-Ray SDK is needed only to add custom subsegments, annotations, or metadata.
    • CIncorrect. Lambda samples 1 request per second plus 5 percent of additional requests, and you can't configure the X-Ray sampling rate for Lambda functions.
    • DIncorrect. X-Ray tracing doesn't require VPC attachment; functions that aren't in a VPC can use Active tracing.
  5. Question 5

    A Lambda function calls a third-party REST API and was deployed with default settings. Its CloudWatch Logs show many "Task timed out after 3.00 seconds" errors. AWS X-Ray traces show that the third-party API consistently takes 4–6 seconds to respond, which is expected for this request. The function's own code finishes in milliseconds after the response arrives. What should the developer do to resolve the errors?

    • AIncrease the function's timeout setting to a value above the API's observed response time
    • BConfigure provisioned concurrency for the function so execution environments are pre-initialized
    • CSet reserved concurrency for the function so it has dedicated capacity in the account
    • DIncrease the number of retry attempts Lambda makes for failed asynchronous invocations
    Show answer and explanation

    Answer: A) Increase the function's timeout setting to a value above the API's observed response time

    When an invocation needs longer than the configured timeout (3 seconds by default) because of expected downstream latency, the fix is to raise the timeout above that latency. Concurrency settings and retry settings don't change how long a single invocation can run.

    • AThe default Lambda timeout is 3 seconds, and it can be raised to 900 seconds. A downstream service that takes longer to respond is a documented common cause of timeouts. Because the 4–6 second wait is expected, the timeout should be set above it with some headroom.
    • BProvisioned concurrency reduces cold-start initialization latency. It doesn't shorten the 4–6 second wait for the API or extend the 3-second limit on each invocation.
    • CReserved concurrency sets the minimum and maximum number of concurrent instances for the function. It doesn't change how long a single invocation may run.
    • DLambda already retries timeouts on asynchronous invocations, but each retry has the same 3-second limit and will also time out while waiting on the API. More retries only add duplicate work.
  6. Question 6

    A Lambda function in account 111111111111 reads objects from an S3 bucket owned by account 222222222222. The function's execution role has an identity-based policy that allows s3:GetObject on the bucket's objects, but every GetObject call fails with AccessDenied. What is the most likely cause?

    • AThe bucket policy in account 222222222222 does not grant the function's execution role access to the objects
    • BThe function's resource-based policy does not grant the s3.amazonaws.com service principal permission to call it
    • CThe execution role's trust policy does not list account 222222222222 as a principal allowed to assume the role
    • DThe function is attached to a VPC that has no NAT gateway or S3 endpoint for reaching Amazon S3
    Show answer and explanation

    Answer: A) The bucket policy in account 222222222222 does not grant the function's execution role access to the objects

    For cross-account access, both the caller's identity-based policy and the resource-based policy in the resource owner's account must allow the request. A bucket policy that doesn't name the execution role causes a consistent AccessDenied even when the identity policy is correct.

    • AFor cross-account requests, AWS evaluates both accounts. The caller's identity-based policy must allow the action, and the resource-based policy in the trusting account (here, the bucket policy) must also allow that principal. Without a bucket policy statement for the execution role, the request is denied even though the identity policy is correct.
    • BA Lambda function's resource-based policy controls who can invoke or manage the function, for example letting S3 invoke it on events. It does not govern outbound calls that the function makes to S3.
    • CThe execution role's trust policy must trust the Lambda service principal (lambda.amazonaws.com) so that Lambda can assume the role. The bucket-owning account does not need to assume the role, so adding it would not fix the denial.
    • DMissing network connectivity makes S3 calls hang and time out. It does not cause an AccessDenied authorization error, which shows the request reached S3 and was rejected by policy evaluation.
  7. Question 7

    An application writes an item to a DynamoDB table and then immediately queries a global secondary index (GSI) for it. The item has values for the GSI key attributes. The first query sometimes doesn't return the item, but the same query run a moment later does. What is the most likely explanation?

    • AWrites are propagated from the base table to the GSI asynchronously, so a query issued right after the write can briefly return stale results.
    • BThe query left ConsistentRead set to false; setting it to true makes the GSI query reflect the write as soon as it succeeds.
    • CThe table uses on-demand capacity mode, which holds index writes until enough read capacity accumulates on the index.
    • DA GSI contains only items that existed when it was created, so newly written items appear only after a manual backfill.
    Show answer and explanation

    Answer: A) Writes are propagated from the base table to the GSI asynchronously, so a query issued right after the write can briefly return stale results.

    DynamoDB updates GSIs asynchronously and they support only eventually consistent reads. A query issued immediately after a write may briefly miss the new item, so applications must allow for slightly stale results.

    • ACorrect. DynamoDB updates GSIs asynchronously using an eventually consistent model. Under normal conditions changes reach the index within a fraction of a second, and applications must expect that a GSI query may return results that are not yet up to date.
    • BIncorrect. GSIs support only eventually consistent reads. Strongly consistent reads aren't available on a GSI, so changing ConsistentRead can't remove the propagation delay.
    • CIncorrect. GSI propagation is eventually consistent in both capacity modes. On-demand mode doesn't hold index writes until read capacity builds up.
    • DIncorrect. DynamoDB keeps each GSI synchronized with its base table automatically. New items that have the index key attributes are propagated to the index without any manual backfill.
  8. Question 8

    A Lambda function's execution role has four customer managed policies attached. Calls to s3:PutObject fail. The CloudTrail event shows errorCode AccessDenied, and the error message says the request was denied 'with an explicit deny in an identity-based policy', with no policy ARN. How can the developer find the exact policy statement causing the denial?

    • ARun the IAM policy simulator against the role for s3:PutObject on the bucket ARN and review the matched statement it reports for the denial
    • BRead the errorMessage field of the CloudTrail event, which lists the Sid of the statement that matched the request and denied it
    • CRun IAM Access Analyzer policy validation on each attached policy and review the findings it reports for the s3:PutObject action
    • DReview the role's last accessed information in the IAM console to see which policy most recently denied the s3:PutObject action
    Show answer and explanation

    Answer: A) Run the IAM policy simulator against the role for s3:PutObject on the bucket ARN and review the matched statement it reports for the denial

    CloudTrail and the AccessDenied message show that a request was denied and which policy type was responsible, sometimes with the policy ARN. The IAM policy simulator evaluates the role's policies for the action and resource and names the specific statement that caused the explicit deny.

    • AThe policy simulator can test a role's attached policies together or one at a time. For an allow or explicit deny result, it identifies the specific statement that produced the outcome, which pinpoints the denying statement.
    • BThe access denied message gives the policy type and sometimes the policy ARN. It does not give the statement Sid. Here it gives no ARN at all, so it cannot isolate the statement.
    • CAccess Analyzer policy validation checks policy grammar and best practices, such as security warnings and errors. It does not evaluate a specific request to show which statement allows or denies it.
    • DLast accessed information shows when a role last used a service or action, to help remove unused permissions. It does not record denials or show which policy statement denied a request.
  9. Question 9

    A Lambda function consumes messages from an Amazon SQS standard queue through an event source mapping. The function timeout is 5 minutes, and the queue's visibility timeout is also 5 minutes. During traffic spikes the function is throttled, and the team sees messages processed a second time while the first invocation is still working on them. Which change follows AWS guidance to fix this?

    • ARaise the queue's visibility timeout to at least six times the function timeout
    • BLower the queue's visibility timeout below the function timeout value
    • CRaise the maxReceiveCount on the queue's dead-letter redrive policy
    • DSet the queue's ReceiveMessageWaitTimeSeconds to 20 to enable long polling
    Show answer and explanation

    Answer: A) Raise the queue's visibility timeout to at least six times the function timeout

    Set the SQS visibility timeout to at least six times the Lambda function timeout. If it is too short, messages can become visible again and be processed twice while an invocation, or a retry after throttling, is still handling them.

    • ACorrect. AWS recommends a visibility timeout of at least six times the function timeout (plus any batching window). The extra time lets Lambda retry after throttling without messages becoming visible to another invocation while they are still being processed.
    • BIncorrect. A shorter visibility timeout makes messages reappear even sooner. Lambda also rejects an event source mapping when the function timeout exceeds the queue's visibility timeout.
    • CIncorrect. maxReceiveCount controls how many receives happen before a message moves to the dead-letter queue. It does not stop a message from becoming visible during in-progress processing.
    • DIncorrect. Long polling reduces empty receive responses, but it has no effect on how long a received message stays hidden from other consumers.
  10. Question 10

    After a code deployment, an application's DynamoDB read capacity consumption rises sharply even though request volume and the number of items returned to the application haven't changed. Which code change is the most likely cause?

    • AKey-based Query calls were replaced with Scan calls that use a FilterExpression to pick items
    • BA ProjectionExpression was added so that each read returns only a subset of item attributes
    • CIndividual GetItem calls were combined into BatchGetItem calls that fetch the same set of items
    • DGetItem calls were changed from strongly consistent reads to eventually consistent reads
    Show answer and explanation

    Answer: A) Key-based Query calls were replaced with Scan calls that use a FilterExpression to pick items

    A Scan consumes read capacity for every item it evaluates, even items its filter discards. Replacing Query with a filtered Scan can sharply increase read consumption without any change in traffic or results.

    • AScan capacity is based on the size of every item evaluated, not the items returned after filtering. Replacing a targeted Query with a filtered Scan can multiply read consumption while the application still gets the same results.
    • BRequesting a subset of attributes has no effect on the item size calculation for read capacity. It neither increases nor decreases the read units consumed.
    • CDynamoDB processes each item in a BatchGetItem as an individual GetItem request. Batching the same items doesn't increase read capacity consumption.
    • DAn eventually consistent read of an item up to 4 KB uses half a read unit, compared with one for a strongly consistent read. This change would lower consumption, not raise it.

Troubleshooting and Optimization: FAQs

How much of the DVA-C02 exam is Troubleshooting and Optimization?

Troubleshooting and Optimization is 18% of the DVA-C02 exam by the official exam guide's weighting, which on a 65-question form works out to roughly 12 questions. The real exam's exact split varies by form.

What does the Troubleshooting and Optimization domain cover?

Finding and fixing problems in running applications and making them faster or cheaper: logging, tracing, metrics and tuning.

How should I study Troubleshooting and Optimization for DVA-C02?

For every error a question describes, ask which log, metric or trace would show it. Most answers are 'look here first'.

Where can I practise more Troubleshooting and Optimization questions?

This page has 10 free Troubleshooting and Optimization questions with answers. CertRidge's DVA-C02 question bank has 120 questions in this domain. Every practice exam result breaks your score down by domain, and Review Mode re-drills the questions you missed.

Get Troubleshooting and Optimization exam-ready

The full DVA-C02 bank has 120 Troubleshooting and Optimization questions. Timed practice exams match the real exam's length and domain weights, every result shows your score per domain, and Review Mode re-drills the questions you missed.

Not affiliated with AWS; questions are original and never copied from the real exam.