Jeff’s Note #
Unlike generic exam dumps, ADH analyzes this scenario through the lens of a Real-World Lead Developer.
For DVA-C02 candidates, the confusion often lies in how to enable effective logging to troubleshoot client-side HTTP 400 errors. In production, this is about knowing exactly which logging configurations give you the granular request/response data you need to identify client errors without flooding your monitoring with irrelevant info. Let’s drill down.
The Certification Drill (Simulated Question) #
Scenario #
GlobalFin, a fintech startup, has developed an API to handle loan application requests using Amazon API Gateway. Recently, clients are reporting HTTP 400 (Bad Request) errors when accessing a specific endpoint. The development team must quickly determine the root cause of these failures to fix malformed client requests or API validation issues.
The Requirement: #
Identify how the lead developer can configure the API and related AWS services to capture detailed diagnostic information about these HTTP 400 errors effectively.
The Options #
- A) Create an Amazon Kinesis Data Firehose delivery stream to receive API call logs from API Gateway. Configure Amazon CloudWatch Logs as the delivery stream’s destination.
- B) Turn on AWS CloudTrail Insights and create a trail. Specify the Amazon Resource Name (ARN) of the trail for the stage of the API.
- C) Turn on AWS X-Ray for the API stage. Create an Amazon CloudWatch Logs log group. Specify the Amazon Resource Name (ARN) of the log group for the API stage.
- D) Turn on execution logging and access logging in Amazon CloudWatch Logs for the API stage. Create a CloudWatch Logs log group. Specify the Amazon Resource Name (ARN) of the log group for the API stage.
Google adsense #
leave a comment:
Correct Answer #
D
Quick Insight: The Developer Imperative #
To troubleshoot HTTP 400 client errors effectively in API Gateway, you need execution and access logs that capture request and response details at the API stage level.
Turning on execution logging provides detailed request data (including request parameters and error messages), while access logs give aggregated client request info for diagnostics.
AWS X-Ray (option C) is powerful for tracing backend service calls but doesn’t provide granular API Gateway request validation error logs.
Kinesis Data Firehose (A) and CloudTrail (B) are unrelated or insufficient for detailed API request/response troubleshooting.
Content Locked: The Expert Analysis #
You’ve identified the answer. But do you know the implementation details that separate a Junior from a Senior?
The Expert’s Analysis #
Correct Answer #
Option D
The Winning Logic #
For an API Gateway endpoint throwing HTTP 400 errors, execution logging and access logging are your best tools. Execution logs record detailed information about API requests and the integration backend’s responses, including validation errors, malformed requests, and parameter mismatches that lead to 400 responses. Meanwhile, access logs track who made requests and their characteristics, helping with client-side diagnostics.
To enable this:
- Create a CloudWatch Logs log group dedicated to the API stage.
- Enable execution logging in the API Gateway stage settings and specify the ARN of the CloudWatch Logs group.
- Enable access logging with a custom format that captures request context and response status codes.
This setup provides visibility into what exactly triggered the 400 error so developers can fix client request issues or API model validations.
The Trap (Distractor Analysis): #
-
Option A: While Kinesis Data Firehose can stream logs, API Gateway does not natively deliver API call logs directly to Firehose. Instead, Firehose is a consumer of CloudWatch Logs or other log sources. This adds unnecessary complexity without enabling detailed API Gateway error analysis.
-
Option B: CloudTrail primarily captures management plane API calls (who called AWS APIs) and resource-level events, not the data plane payloads or request/response details inside API Gateway endpoints. CloudTrail Insights is an anomaly detection tool and can’t diagnose API-level client errors.
-
Option C: AWS X-Ray helps trace requests flowing through various AWS services but does not capture API Gateway execution logs or request validation errors that cause HTTP 400 client errors. Enabling X-Ray without execution/access logging misses critical request error context.
The Technical Blueprint #
Relevant CLI snippet to enable execution and access logging #
# Create CloudWatch Logs group
aws logs create-log-group --log-group-name /aws/apigateway/globalfin-loans-api-stage
# Enable execution logging and access logging for the API stage
aws apigateway update-stage \
--rest-api-id a1b2c3d4 \
--stage-name dev \
--patch-operations op=replace,path=/accessLogSettings/destinationArn,value=arn:aws:logs:us-east-1:123456789012:log-group:/aws/apigateway/globalfin-loans-api-stage \
op=replace,path=/accessLogSettings/format,value='$context.requestId $context.identity.sourceIp $context.httpMethod $context.resourcePath $context.status $context.protocol' \
op=replace,path=/methodSettings/*/*/logging/loglevel,value=INFO \
op=replace,path=/methodSettings/*/*/logging/dataTrace,value=true
The Comparative Analysis #
| Option | API Complexity | Performance Impact | Use Case/Effectiveness |
|---|---|---|---|
| A | High (setup Firehose pipeline) | Moderate (extra delivery step) | Not suitable for API Gateway client error logs; indirect method |
| B | Low | Low | CloudTrail logs API calls, not application request content |
| C | Medium | Low to Moderate | Good for tracing backend services but no detailed API Gateway error log |
| D | Low | Low | Official and recommended way to diagnose API Gateway HTTP 400 errors |
Real-World Application (Practitioner Insight) #
Exam Rule #
For the exam, always pick execution logging + access logging in CloudWatch when you see API Gateway troubleshooting HTTP 400 errors.
Real World #
In production, teams might augment this with X-Ray to trace downstream issues, but the first step to fix client-facing 400 errors is enabling those execution and access logs for API Gateway itself.
(CTA) Stop Guessing, Start Mastering #
Disclaimer
This is a study note based on simulated scenarios for the DVA-C02 exam.