A startup is building a multi-tenant SaaS application on AWS. The application exposes a REST API through Amazon API Gateway. The startup uses an Amazon Cognito User Pool for user authentication, and the frontend client receives a JSON Web Token (JWT) after successful login. The developer needs to secure a set of API endpoints: some endpoints require validation of standard JWT claims, while other endpoints require validating the JWT and then looking up the user's subscription status in a DynamoDB table to grant or deny access. Which two configuration methods should the developer use on the API Gateway endpoints to meet these requirements with the least operational overhead? (Select TWO.)
- Configure a built-in API Gateway Amazon Cognito user pool authorizer for endpoints that only require standard JWT claim validation.Cevap
- Configure an API Gateway Lambda authorizer of token type for endpoints that require querying the database to check subscription status.Cevap
- CConfigure an API Gateway Lambda authorizer of request parameter type to manually verify the JWT signature and expiration for standard claims.
- DConfigure an Amazon Cognito Identity Pool authorizer directly on API Gateway to validate the JWT and verify the subscription status.
- EConfigure API Gateway Lambda Proxy integration with IAM authorization to automatically pass the client JWT to the backend Lambda function.
Cevap
To secure the API endpoints with minimal operational overhead, the developer should configure a built-in API Gateway Amazon Cognito user pool authorizer for the standard JWT claim validation, and configure an API Gateway Lambda authorizer of token type for endpoints requiring a DynamoDB database lookup.
For endpoints requiring only standard validation of Cognito User Pool JWTs, using the built-in API Gateway Cognito User Pool authorizer requires no custom code, minimizing operational overhead. For endpoints requiring database checks (such as verifying subscription status in DynamoDB), a custom Lambda authorizer must be used to execute the custom database query and return the corresponding IAM policy.
Adım Adım Çözüm
Anahtar Kavram
API Gateway Authorizers selection based on requirement complexity