A developer is implementing a serverless analytics dashboard. Users must register and log in to the dashboard, which is built as a single-page application (SPA). The application needs to call secure endpoints on Amazon API Gateway to fetch user profile data. Additionally, the client-side application must publish telemetry logs directly to an Amazon Kinesis Data Stream for real-time analysis. Which TWO steps should the developer perform to meet these security requirements with the least operational overhead?
- Configure a Cognito User Pool to manage user authentication, and create a Cognito User Pool Authorizer in API Gateway to validate the ID tokens sent in the HTTP request headers.Answer
- Create a Cognito Identity Pool that uses the User Pool as an identity provider, and assign an authenticated IAM role with permissions to write to the Kinesis Data Stream.Answer
- CDevelop a custom Lambda Authorizer in API Gateway that parses the Cognito User Pool access token, performs manual verification against the public JWKS endpoint, and generates an IAM policy for the REST API.
- DConfigure API Gateway to use AWS_IAM authorization, and utilize the Cognito User Pool directly to issue temporary IAM credentials for signing requests to the REST API.
- EIntegrate the Kinesis Data Stream with the Cognito User Pool, configuring a User Pool client-side policy to grant stream write permissions to authenticated users.
Answer
To meet the requirements with the least operational overhead, the developer should configure a Cognito User Pool with a Cognito Authorizer in API Gateway to secure the API endpoints, and use a Cognito Identity Pool linked to the User Pool to provide temporary IAM credentials that grant write permissions to the Kinesis Data Stream.
The correct solution uses the native features of AWS services to minimize custom code. By configuring a Cognito User Pool, the developer establishes a user directory. Setting up a Cognito User Pool Authorizer on API Gateway allows the platform to natively inspect and validate the ID tokens. To interact with Amazon Kinesis directly from the client, the developer uses a Cognito Identity Pool to trade the User Pool's JWTs for temporary, restricted AWS IAM credentials, which contain permission to execute the write action on the stream.
Step-by-Step Solution
Key Concept
Integration of Cognito User Pools for user directory authentication, Cognito Identity Pools for authorizing direct AWS resource access (such as S3, DynamoDB, or Kinesis) via temporary credentials, and API Gateway Cognito Authorizers for securing REST endpoints.