A developer is building a web application that allows users to sign in using Amazon Cognito. The backend REST API is hosted on Amazon API Gateway. The developer needs to secure the API so that only authenticated users can access the resources. The solution must minimize code maintenance, overhead, and latency. Which configuration should the developer implement to meet these requirements?
- ACreate a custom Lambda authorizer that validates the Amazon Cognito JSON Web Token (JWT) by fetching the public JSON Web Key Set (JWKS) from the user pool.
- Configure an Amazon Cognito User Pool authorizer on the API Gateway methods and pass the Cognito identity token in the request header.Cevap
- CIntegrate an Amazon Cognito Identity Pool with API Gateway using IAM authorization, and sign all incoming client requests using Signature Version 4.
- DConfigure a Lambda proxy integration on the API methods and implement custom token validation logic inside the backend Lambda function.
Cevap
Configure an Amazon Cognito User Pool authorizer on the API Gateway methods and pass the Cognito identity token in the request header.
Configuring an Amazon Cognito User Pool authorizer allows API Gateway to automatically validate the incoming identity token without requiring custom Lambda code. This minimizes latency, development effort, and execution costs compared to custom authorizers.
Adım Adım Çözüm
Anahtar Kavram
API Gateway built-in Cognito User Pool Authorizers provide native, low-latency validation of JSON Web Tokens (JWT) without writing or managing custom backend code.
Tahmini Süre:1m 30s