Question 1,135 of 724
DVA-C02 Security Practice Question
An application uses Amazon Cognito user pools for authentication. A developer wants to restrict access to an API Gateway endpoint to only authenticated users from a specific user pool. What is the best approach?
⚠ Common exam trap
The trap here is that candidates often overcomplicate the solution by choosing a Lambda authorizer (option D) because they think they need custom validation logic, forgetting that API Gateway has a built-in Cognito User Pool authorizer that handles JWT validation natively without any custom code.
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
✓
Use a Cognito User Pool authorizer in API Gateway.
A Cognito User Pool authorizer in API Gateway is the native, fully managed way to restrict access to an API endpoint to authenticated users from a specific user pool. It automatically validates the JWT token issued by the user pool and caches the result, requiring no custom code. This approach integrates directly with API Gateway's authorization flow, ensuring only tokens from the specified user pool are accepted.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Attach an IAM policy to the API Gateway resource that allows only the Cognito user pool ARN.
Why it's wrong here
Attaching an IAM policy to an API Gateway resource is designed to control access for AWS IAM principals (users, roles) or AWS services, not to authenticate individual end-users from a Cognito User Pool. IAM policies operate by evaluating the identity of the caller against defined permissions, but they lack the capability to interpret and validate a JSON Web Token (JWT) issued by a Cognito User Pool for end-user authentication.
- ✓
Use a Cognito User Pool authorizer in API Gateway.
Why this is correct
The Cognito User Pool authorizer in API Gateway is the purpose-built, native solution for validating JWTs issued by Amazon Cognito User Pools. It automatically inspects the `Authorization` header for a valid JWT, verifies its signature against the user pool's public keys, checks its expiration, and confirms the issuer. Upon successful validation, API Gateway allows the request to proceed to the backend integration, often passing decoded token claims for application use.
- ✗
Use an API Gateway resource policy that allows access only from the Cognito user pool.
Why it's wrong here
An API Gateway resource policy defines high-level access controls for the API itself, typically based on source IP addresses, VPC endpoints, or specific AWS IAM principals. This policy acts as a firewall-like mechanism, determining who can invoke the API at a broad level, but it does not possess the functionality to authenticate individual end-users by validating their specific JWTs issued by a Cognito User Pool.
- ✗
Use a Lambda authorizer that validates the JWT token against the user pool.
Why it's wrong here
While technically feasible, using a Lambda authorizer to validate a JWT token against a Cognito User Pool introduces unnecessary complexity, latency, and operational overhead. This approach requires writing and maintaining custom Lambda code to perform the same JWT validation steps (signature, expiration, issuer checks) that API Gateway's native Cognito User Pool authorizer handles automatically. The built-in authorizer is more efficient and cost-effective for this specific use case.
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 →
Last reviewed: Jun 24, 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.