Soru

Zorluk: KolayAPI Gateway Security and Authorization

A developer is securing a new Amazon API Gateway REST API. The developer wants to restrict access so that only authenticated users from an Amazon Cognito User Pool can call the API. Which TWO configuration steps are required to set up this built-in authorization mechanism?

  1. Create an API Gateway authorizer of type Cognito and configure it with the Amazon Cognito User Pool details.Cevap
  2. Set the authorization type of the API method to the Cognito authorizer that was created.Cevap
  3. C
    Create an API Gateway authorizer of type Cognito and configure it with the Amazon Cognito Identity Pool ID.
  4. D
    Create an API Gateway Lambda authorizer to manually decode and validate the Cognito JSON Web Token (JWT).
  5. E
    Enable Lambda proxy integration and write custom logic in the backend function to validate the client's IAM credentials.

Cevap

To implement native Amazon Cognito User Pools authorization for an API Gateway REST API, the developer must first create an authorizer of type Cognito linked to the Cognito User Pool, and then configure the target API methods to use this authorizer.
To secure an API using built-in Cognito validation, API Gateway requires setting up a Cognito authorizer that targets the Cognito User Pool containing the user identities, and then configuring the API methods to enforce this authorization setting.

Adım Adım Çözüm

1
Define a Cognito user pool authorizer in API Gateway
API Gateway is configured with the metadata of the User Pool to validate incoming tokens.
This establishes the link between API Gateway and the Cognito User Pool identity provider.
2
Configure the API method to use the authorizer
The authorization setting on the method execution is updated to the newly created authorizer.
This secures the specific endpoint, ensuring incoming requests are automatically validated using the Cognito token before routing to the integration backend.

Anahtar Kavram

API Gateway Cognito User Pools Authorizer configuration
Bu soruyu puanla