A developer is designing a REST API in Amazon API Gateway to serve as a backend for a mobile application. The API must validate user identity tokens issued by Amazon Cognito User Pools. Once authenticated, the requests must be routed to an AWS Lambda function. To minimize custom code maintenance, execution overhead, and configuration complexity, the developer wants to avoid writing custom request mapping templates or token validation code in API Gateway. Which TWO actions should the developer take to meet these requirements?
- Configure a Cognito User Pool Authorizer on the API Gateway method.Cevap
- Use Lambda Proxy Integration for the integration request configuration.Cevap
- CCreate a custom Lambda Authorizer to validate the user's Cognito JSON Web Token (JWT).
- DUse a Lambda Custom Integration and configure Velocity Template Language (VTL) mapping templates to pass request parameters.
- EConfigure a Lambda Custom Integration and write code inside the Lambda function to parse the raw HTTP request structure directly from the event object.
Cevap
Configure a Cognito User Pool Authorizer on the API Gateway method and use Lambda Proxy Integration for the integration request configuration.
The correct options are configuring a Cognito User Pool Authorizer and using Lambda Proxy Integration. A Cognito User Pool Authorizer allows API Gateway to automatically validate identity tokens issued by Amazon Cognito without writing custom validation code. Lambda Proxy Integration passes the raw client request details directly to the backend Lambda function, eliminating the need to write and maintain Velocity Template Language (VTL) mapping templates in API Gateway.
Adım Adım Çözüm
Anahtar Kavram
API Gateway offers native integrations and authentication mechanisms to reduce code overhead, including Cognito User Pool Authorizers and Lambda Proxy Integrations.