- A
The connection draining timeout is too short, causing the ALB to terminate connections before in-flight requests finish.
When connection draining is enabled, the ALB waits for the draining timeout before deregistering the instance. If the timeout is too short, requests still in progress are terminated, resulting in 502 errors.
- B
The health check interval is set too long, causing the ALB to consider unhealthy instances as healthy.
Why wrong: An overly long health check interval may delay the detection of unhealthy instances, but the issue described involves instances in 'Draining' state, which are known to be deregistering. Health checks are not the primary cause.
- C
Cross-zone load balancing is disabled, so the ALB is routing requests to instances that are already draining.
Why wrong: Cross-zone load balancing affects traffic distribution across availability zones but does not cause 502 errors during connection draining. The target group still includes draining instances regardless of cross-zone setting.
- D
The Auto Scaling group's minimum size is too small, causing the ALB to have no healthy targets.
Why wrong: If the minimum size is too small, there might be no healthy targets at all, leading to 503 errors, not 502. The problem is specific to connections being terminated during draining.
Quick Answer
The answer is that the connection draining timeout is too short, causing the ALB to terminate connections before in-flight requests finish. When an instance enters the 'Draining' state during a rolling update, the Application Load Balancer stops sending new traffic but waits up to the configured timeout—here, 30 seconds—for existing requests to complete. If the timeout expires before those requests finish, the ALB forcibly closes the connections, and the Auto Scaling group terminates the instance, leaving clients with incomplete responses and a 502 Bad Gateway error. On the AWS Certified Developer Associate DVA-C02 exam, this scenario tests your understanding of how connection draining interacts with Auto Scaling lifecycle hooks and the ALB’s request completion window. A common trap is assuming the 502 is caused by a health check failure or a misconfigured target group, when the real culprit is an insufficient draining timeout for long-running requests. Memory tip: think of connection draining as a “graceful goodbye”—if you rush it (too short a timeout), you’ll leave clients hanging with a 502.
DVA-C02 Troubleshooting and Optimization Practice Question
This DVA-C02 practice question tests your understanding of troubleshooting and optimization. Read the scenario carefully and evaluate each option against the stated constraints before committing to an answer. A key principle to apply: connection draining (deregistration delay) allows in-flight requests to complete before an instance is removed.. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
A web application runs on Amazon EC2 instances behind an Application Load Balancer (ALB). During rolling updates of the Auto Scaling group, users intermittently receive HTTP 502 (Bad Gateway) errors. The developer checks the ALB access logs and notices that requests are being routed to instances that are in the 'Draining' state. The ALB has connection draining enabled with a timeout of 30 seconds. The Auto Scaling group terminates instances after they are taken out of service. What is the most likely cause of the 502 errors?
Clue words in this question
Noticing these words before you look at the options changes how you read each choice.
Clue:
"most likely"Why it matters: Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.
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
The connection draining timeout is too short, causing the ALB to terminate connections before in-flight requests finish.
The 502 errors occur because the ALB's connection draining timeout of 30 seconds is too short to allow all in-flight requests to complete before the Auto Scaling group terminates the instances. When an instance enters the 'Draining' state, the ALB stops sending new requests but waits up to the draining timeout for existing connections to finish. If the timeout expires before requests complete, the ALB forcibly closes connections, resulting in HTTP 502 (Bad Gateway) errors for clients whose requests were still in progress.
Key principle: Connection draining (deregistration delay) allows in-flight requests to complete before an instance is removed.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The connection draining timeout is too short, causing the ALB to terminate connections before in-flight requests finish.
Why this is correct
When connection draining is enabled, the ALB waits for the draining timeout before deregistering the instance. If the timeout is too short, requests still in progress are terminated, resulting in 502 errors.
Clue confirmation
The clue word "most likely" in the question point toward this answer.
Related concept
Connection draining (deregistration delay) allows in-flight requests to complete before an instance is removed.
- ✗
The health check interval is set too long, causing the ALB to consider unhealthy instances as healthy.
Why it's wrong here
An overly long health check interval may delay the detection of unhealthy instances, but the issue described involves instances in 'Draining' state, which are known to be deregistering. Health checks are not the primary cause.
- ✗
Cross-zone load balancing is disabled, so the ALB is routing requests to instances that are already draining.
Why it's wrong here
Cross-zone load balancing affects traffic distribution across availability zones but does not cause 502 errors during connection draining. The target group still includes draining instances regardless of cross-zone setting.
- ✗
The Auto Scaling group's minimum size is too small, causing the ALB to have no healthy targets.
Why it's wrong here
If the minimum size is too small, there might be no healthy targets at all, leading to 503 errors, not 502. The problem is specific to connections being terminated during draining.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates often confuse connection draining timeout with health check interval, assuming that a long health check interval causes the ALB to route to unhealthy instances, when in fact the 502 errors are caused by the ALB forcibly terminating connections before in-flight requests complete due to an insufficient draining timeout.
Detailed technical explanation
How to think about this question
Connection draining (also known as deregistration delay) works by allowing the ALB to complete in-flight requests to a target that is being deregistered, up to a configurable timeout (default 300 seconds, but set to 30 seconds here). The ALB tracks active connections via the TCP state machine and waits for them to close naturally; if the timeout expires, the ALB sends a TCP RST to the client, causing a 502 error. In practice, long-running requests (e.g., large file uploads or database queries) can exceed a short draining timeout, making this a common misconfiguration during rolling updates.
KKey Concepts to Remember
- Connection draining (deregistration delay) allows in-flight requests to complete before an instance is removed.
- A 502 error from an ALB often indicates an issue with the backend target's response or connection.
- If deregistration delay is too short, the ALB terminates connections prematurely, causing 502 errors.
- Rolling updates in Auto Scaling groups frequently involve instances entering a 'Draining' state.
TExam Day Tips
- Watch for words such as best, first, most likely and least administrative effort.
- Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Connection draining (deregistration delay) allows in-flight requests to complete before an instance is removed.
Real-world example
How this comes up in practice
A company's IT admin needs to give a contractor read-only access to production logs without sharing account credentials. Using role-based access control (RBAC) and temporary scoped permissions — not a permanent shared password — is the correct pattern. Questions like this test whether you can apply least-privilege access across cloud identity services.
What to study next
Got this wrong? Here's your next step.
Review connection draining (deregistration delay) allows in-flight requests to complete before an instance is removed., then practise related DVA-C02 questions on the same topic to reinforce the concept.
- →
Troubleshooting and Optimization — study guide chapter
Learn the concepts, then practise the questions
- →
Troubleshooting and Optimization practice questions
Targeted practice on this topic area only
- →
All DVA-C02 questions
1,616 questions across all exam domains
- →
AWS Certified Developer Associate DVA-C02 study guide
Full concept coverage aligned to exam objectives
- →
DVA-C02 practice test guide
How to use practice tests most effectively before exam day
Related practice questions
Related DVA-C02 practice-question pages
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
Development with AWS Services practice questions
Practise DVA-C02 questions linked to Development with AWS Services.
Security practice questions
Practise DVA-C02 questions linked to Security.
Deployment practice questions
Practise DVA-C02 questions linked to Deployment.
Troubleshooting and Optimization practice questions
Practise DVA-C02 questions linked to Troubleshooting and Optimization.
DVA-C02 fundamentals practice questions
Practise DVA-C02 questions linked to DVA-C02 fundamentals.
DVA-C02 scenario practice questions
Practise DVA-C02 questions linked to DVA-C02 scenario.
DVA-C02 troubleshooting practice questions
Practise DVA-C02 questions linked to DVA-C02 troubleshooting.
Practice this exam
Start a free DVA-C02 practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this DVA-C02 question test?
Troubleshooting and Optimization — This question tests Troubleshooting and Optimization — Connection draining (deregistration delay) allows in-flight requests to complete before an instance is removed..
What is the correct answer to this question?
The correct answer is: The connection draining timeout is too short, causing the ALB to terminate connections before in-flight requests finish. — The 502 errors occur because the ALB's connection draining timeout of 30 seconds is too short to allow all in-flight requests to complete before the Auto Scaling group terminates the instances. When an instance enters the 'Draining' state, the ALB stops sending new requests but waits up to the draining timeout for existing connections to finish. If the timeout expires before requests complete, the ALB forcibly closes connections, resulting in HTTP 502 (Bad Gateway) errors for clients whose requests were still in progress.
What should I do if I get this DVA-C02 question wrong?
Review connection draining (deregistration delay) allows in-flight requests to complete before an instance is removed., then practise related DVA-C02 questions on the same topic to reinforce the concept.
Are there clue words in this question I should notice?
Yes — watch for: "most likely". Probability qualifier — the question wants the most probable cause or outcome, not a guaranteed one. Eliminate low-probability options.
What is the key concept behind this question?
Connection draining (deregistration delay) allows in-flight requests to complete before an instance is removed.
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 →
Keep practising
More DVA-C02 practice questions
- A developer is troubleshooting an AWS Lambda function that is triggered by an S3 event. The function occasionally fails…
- A developer needs to call AWS APIs from application code running on EC2. Which credential source should the AWS SDK use…
- A developer needs to allow an IAM user in a different AWS account to assume a role in the developer's account. The role…
- A developer needs to grant an IAM role in Account B read-only access to objects in an S3 bucket in Account A. The bucket…
- An API Gateway HTTP API should allow access only to users authenticated by an external OIDC provider. Which authorizer t…
- A developer monitors an AWS Lambda function that processes messages from an Amazon SQS queue. CloudWatch logs show that…
Last reviewed: Jun 11, 2026
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.
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.
Sign in to join the discussion.