Amazon AWS Certified Developer - Associate DVA-C02 Practice Test 4
Question 30
A Lambda processes SQS batches where one bad record should not cause nine successful records to repeat. Which implementation approach BEST addresses this requirement?
- Delete the full SQS queue when one record fails.
- Enable partial batch responses and return the identifiers of failed batch items from the handler.
- Increase API Gateway rate limits to control SQS batch acknowledgements.
- Mark every batch entry failed to preserve one error.
Explanation
Correct Answer
B:Enable partial batch responses and return the identifiers of failed batch items from the handler. SQS partial batch response avoids unnecessary redelivery of successful records in a partially failed batch. A confirming test would show: Only failed message IDs are retried while acknowledged batch records remain completed.
Incorrect Answers
A:Delete the full SQS queue when one record fails. This suggestion does not establish the required Lambda event source partial batch response; the relevant risk is that raising an exception for the whole batch makes the entire batch eligible for retry.
C:Increase API Gateway rate limits to control SQS batch acknowledgements. This suggestion does not establish the required Lambda event source partial batch response; the relevant risk is that raising an exception for the whole batch makes the entire batch eligible for retry.
D:Mark every batch entry failed to preserve one error. This suggestion does not establish the required Lambda event source partial batch response; the relevant risk is that raising an exception for the whole batch makes the entire batch eligible for retry.
Question 31
A checkout Lambda returns occasional 500 errors and its logs include a requestId and errorCode. Which implementation approach BEST addresses this requirement?
- Delete the error log group to restart the handler.
- Increase Lambda memory without examining any error evidence.
- Query CloudWatch Logs Insights with structured fields and the request correlation identifier.
- Use S3 lifecycle deletion as a Logs Insights query filter.
Explanation
Correct Answer
C:Query CloudWatch Logs Insights with structured fields and the request correlation identifier. Correlation IDs allow developers to join related log records and reduce noisy searches. A confirming test would show: The query isolates timestamps and the exact error records associated with the failed request.
Incorrect Answers
A:Delete the error log group to restart the handler. This suggestion does not establish the required CloudWatch Logs Insights root cause; the relevant risk is that searching broad unstructured text without a request key obscures the relevant failure path.
B:Increase Lambda memory without examining any error evidence. This suggestion does not establish the required CloudWatch Logs Insights root cause; the relevant risk is that searching broad unstructured text without a request key obscures the relevant failure path.
D:Use S3 lifecycle deletion as a Logs Insights query filter. This suggestion does not establish the required CloudWatch Logs Insights root cause; the relevant risk is that searching broad unstructured text without a request key obscures the relevant failure path.
Question 32
A support representative can view order state but must not see full customer identity numbers. Which implementation approach BEST addresses this requirement?
- Apply field-level authorization and mask sensitive attributes before serializing responses.
- Hide fields only with CSS in the browser.
- Return all PII in JSON and rely on users not opening dev tools.
- Set an S3 lifecycle rule on the API response body.
Explanation
Correct Answer
A:Apply field-level authorization and mask sensitive attributes before serializing responses. Response masking and field authorization must run before data is returned to a caller. A confirming test would show: Requests from nonprivileged roles contain masked fields while approved roles get only permitted detail.
Incorrect Answers
B:Hide fields only with CSS in the browser. This suggestion does not establish the required PII response field masking; the relevant risk is that logging or returning raw records before masking exposes PII despite correct database encryption.
C:Return all PII in JSON and rely on users not opening dev tools. This suggestion does not establish the required PII response field masking; the relevant risk is that logging or returning raw records before masking exposes PII despite correct database encryption.
D:Set an S3 lifecycle rule on the API response body. This suggestion does not establish the required PII response field masking; the relevant risk is that logging or returning raw records before masking exposes PII despite correct database encryption.
Question 33
A mobile client must gracefully recover when a short-lived OAuth access token expires. Which implementation approach BEST addresses this requirement?
- Validate token expiry and use the provider's supported refresh flow rather than accepting expired tokens.
- Set access tokens to never expire because users dislike sign-in.
- Encode a username in base64 and treat it as a JWT.
- Accept tokens without verifying their signature.
Explanation
Correct Answer
A:Validate token expiry and use the provider's supported refresh flow rather than accepting expired tokens. Bearer tokens are bounded credentials and server-side expiry checks cannot be replaced by client clock trust. A confirming test would show: The client obtains a fresh access token and the protected API rejects an expired one.
Incorrect Answers
B:Set access tokens to never expire because users dislike sign-in. This suggestion does not establish the required bearer token refresh and expiry; the relevant risk is that ignoring exp claims leaves a path for stale tokens to be reused as authorization.
C:Encode a username in base64 and treat it as a JWT. This suggestion does not establish the required bearer token refresh and expiry; the relevant risk is that ignoring exp claims leaves a path for stale tokens to be reused as authorization.
D:Accept tokens without verifying their signature. This suggestion does not establish the required bearer token refresh and expiry; the relevant risk is that ignoring exp claims leaves a path for stale tokens to be reused as authorization.
Question 34
Multiple Python Lambda functions must share a versioned dependency without copying vendor packages into each source tree. Which implementation approach BEST addresses this requirement?
- Publish compatible dependencies as a versioned Lambda layer and attach the required layer version to functions.
- Use an API Gateway mapping template to install native Python packages.
- Attach the layer without checking runtime or architecture compatibility.
- Put the dependency archive in CloudWatch Logs expecting Lambda to import it.
Explanation
Correct Answer
A:Publish compatible dependencies as a versioned Lambda layer and attach the required layer version to functions. Lambda layers package reusable dependencies separately while runtime compatibility must still match. A confirming test would show: Each function loads the expected dependency version under the declared runtime and architecture.
Incorrect Answers
B:Use an API Gateway mapping template to install native Python packages. This suggestion does not establish the required Lambda layer dependency management; the relevant risk is that a layer built for a different runtime or architecture can cause module import failures.
C:Attach the layer without checking runtime or architecture compatibility. This suggestion does not establish the required Lambda layer dependency management; the relevant risk is that a layer built for a different runtime or architecture can cause module import failures.
D:Put the dependency archive in CloudWatch Logs expecting Lambda to import it. This suggestion does not establish the required Lambda layer dependency management; the relevant risk is that a layer built for a different runtime or architecture can cause module import failures.
Question 35
A busy Lambda fetches a secret on each request and causes avoidable Secrets Manager API traffic. Which implementation approach BEST addresses this requirement?
- Store secrets in publicly writable object tags.
- Cache secrets for a bounded interval and refresh on expiry or authentication failure using least-privilege access.
- Cache the sensitive value forever in the container image.
- Disable auditing for GetSecretValue requests.
Explanation
Correct Answer
B:Cache secrets for a bounded interval and refresh on expiry or authentication failure using least-privilege access. Bounded secret caching reduces repeated retrieval without making old credentials permanent. A confirming test would show: Secret-read API volume declines while newly rotated credentials are adopted within the specified refresh window.
Incorrect Answers
A:Store secrets in publicly writable object tags. This suggestion does not establish the required credential caching refresh; the relevant risk is that a process-wide cache with no expiry continues to use revoked values.
C:Cache the sensitive value forever in the container image. This suggestion does not establish the required credential caching refresh; the relevant risk is that a process-wide cache with no expiry continues to use revoked values.
D:Disable auditing for GetSecretValue requests. This suggestion does not establish the required credential caching refresh; the relevant risk is that a process-wide cache with no expiry continues to use revoked values.
Question 36
A serverless handler loads a vendor token but currently prints all environment variables on errors. Which implementation approach BEST addresses this requirement?
- Make the log group public so failures are easier to share.
- Rely on a KMS key to retroactively hide already logged plaintext.
- Add more verbose logs of complete bearer tokens.
- Redact secret-bearing environment values and authorization headers from structured application logs.
Explanation
Correct Answer
D:Redact secret-bearing environment values and authorization headers from structured application logs. Encryption at rest does not stop an application from leaking plaintext secrets during logging. A confirming test would show: Controlled failure tests produce usable trace metadata but no credential material in logs.
Incorrect Answers
A:Make the log group public so failures are easier to share. This suggestion does not establish the required Lambda environment secret leakage; the relevant risk is that dumping secrets into CloudWatch Logs exposes credentials to log readers.
B:Rely on a KMS key to retroactively hide already logged plaintext. This suggestion does not establish the required Lambda environment secret leakage; the relevant risk is that dumping secrets into CloudWatch Logs exposes credentials to log readers.
C:Add more verbose logs of complete bearer tokens. This suggestion does not establish the required Lambda environment secret leakage; the relevant risk is that dumping secrets into CloudWatch Logs exposes credentials to log readers.
Question 37
An ECS container starts but should receive traffic only after its database connection pool is ready. Which implementation approach BEST addresses this requirement?
- Return HTTP 200 for readiness before required dependencies initialize.
- Use CloudFront invalidation as a health probe for an ECS process.
- Restart the process for every transient database read failure.
- Separate liveness checks from readiness checks and return healthy only when the correct condition holds.
Explanation
Correct Answer
D:Separate liveness checks from readiness checks and return healthy only when the correct condition holds. Readiness controls whether a service should receive requests; liveness indicates whether the process needs restarting. A confirming test would show: Traffic reaches only ready tasks while a temporary dependency delay does not force needless process restarts.
Incorrect Answers
A:Return HTTP 200 for readiness before required dependencies initialize. This suggestion does not establish the required readiness versus liveness checks; the relevant risk is that a single strict probe for every purpose can create restart loops during transient dependency slowness.
B:Use CloudFront invalidation as a health probe for an ECS process. This suggestion does not establish the required readiness versus liveness checks; the relevant risk is that a single strict probe for every purpose can create restart loops during transient dependency slowness.
C:Restart the process for every transient database read failure. This suggestion does not establish the required readiness versus liveness checks; the relevant risk is that a single strict probe for every purpose can create restart loops during transient dependency slowness.
Question 38
A Lambda role has an allow statement for S3 reads but calls are still denied by a higher-scope policy. Which implementation approach BEST addresses this requirement?
- Rename the role without inspecting policy statements.
- Disable CloudTrail to make denied API calls succeed.
- Attach an additional wildcard Allow to override every Deny.
- Evaluate explicit denies in identity, resource, permissions-boundary, and organization policy paths.
Explanation
Correct Answer
D:Evaluate explicit denies in identity, resource, permissions-boundary, and organization policy paths. An explicit Deny takes precedence over any applicable Allow in AWS policy evaluation. A confirming test would show: Policy evaluation identifies a matching explicit deny even though an Allow statement also matches.
Incorrect Answers
A:Rename the role without inspecting policy statements. This suggestion does not establish the required IAM policy explicit deny; the relevant risk is that adding another Allow statement does not override an explicit Deny.
B:Disable CloudTrail to make denied API calls succeed. This suggestion does not establish the required IAM policy explicit deny; the relevant risk is that adding another Allow statement does not override an explicit Deny.
C:Attach an additional wildcard Allow to override every Deny. This suggestion does not establish the required IAM policy explicit deny; the relevant risk is that adding another Allow statement does not override an explicit Deny.
Question 39
A container-based Lambda built on an ARM workstation fails because its image architecture differs from the selected function architecture. Which implementation approach BEST addresses this requirement?
- Build and publish a container image for the target runtime platform and set compatible deployment architecture.
- Change the API Gateway stage to arm64 without changing the image.
- Assume all OCI image manifests work on every CPU architecture.
- Reduce load-balancer health-check frequency to repair an executable-format error.
Explanation
Correct Answer
A:Build and publish a container image for the target runtime platform and set compatible deployment architecture. CPU architecture and container-image manifests must match the target runtime. A confirming test would show: The image manifest and a deployed smoke test match the target compute architecture.
Incorrect Answers
B:Change the API Gateway stage to arm64 without changing the image. This suggestion does not establish the required container image architecture compatibility; the relevant risk is that an architecture mismatch can prevent image startup even when application source is valid.
C:Assume all OCI image manifests work on every CPU architecture. This suggestion does not establish the required container image architecture compatibility; the relevant risk is that an architecture mismatch can prevent image startup even when application source is valid.
D:Reduce load-balancer health-check frequency to repair an executable-format error. This suggestion does not establish the required container image architecture compatibility; the relevant risk is that an architecture mismatch can prevent image startup even when application source is valid.
Question 40
A request crosses API Gateway and several Lambda-backed service calls but its latency cannot be attributed. Which implementation approach BEST addresses this requirement?
- Enable supported tracing and propagate trace context through service calls and instrumentation.
- Turn off tracing in every downstream service.
- Replace trace context with a fixed user password.
- Generate an unrelated trace ID for every internal call.
Explanation
Correct Answer
A:Enable supported tracing and propagate trace context through service calls and instrumentation. Trace propagation links work across components; isolated logs alone cannot reconstruct spans reliably. A confirming test would show: A trace view shows related segments or subsegments with timing for the connected service path.
Incorrect Answers
B:Turn off tracing in every downstream service. This suggestion does not establish the required X-Ray trace propagation; the relevant risk is that missing trace context between calls breaks a distributed trace even when local segments exist.
C:Replace trace context with a fixed user password. This suggestion does not establish the required X-Ray trace propagation; the relevant risk is that missing trace context between calls breaks a distributed trace even when local segments exist.
D:Generate an unrelated trace ID for every internal call. This suggestion does not establish the required X-Ray trace propagation; the relevant risk is that missing trace context between calls breaks a distributed trace even when local segments exist.