A developer is building a client proofing portal for a photography studio. The portal must authenticate clients using email and password, allow them to upload selection feedback files directly to a secure Amazon S3 bucket, and access private backend APIs on Amazon API Gateway. Which TWO actions must the developer take to configure the authentication and authorization flow?
- Set up a Cognito User Pool to handle user registration and sign-in, and configure a Cognito User Pool Authorizer on API Gateway to secure the APIs.Answer
- Set up a Cognito Identity Pool that uses the User Pool as an identity provider to obtain temporary AWS credentials for S3 bucket uploads.Answer
- CSet up a Cognito User Pool to generate temporary AWS credentials for S3 uploads using Cognito Sync.
- DCreate a custom API Gateway Lambda Authorizer that decodes and validates the Cognito User Pool identity tokens to authorize API calls.
- ECreate a Cognito Identity Pool to store user profiles and authenticate users directly via email and password.
Answer
To configure the authentication and authorization flow, the developer must set up a Cognito User Pool to manage authentication and secure the API Gateway using a Cognito User Pool Authorizer, and set up a Cognito Identity Pool referencing the User Pool to obtain temporary AWS credentials for S3 uploads.
The system requires a Cognito User Pool to handle user directory registration, login, and token generation. The backend APIs are secured with minimal complexity by using the native Cognito User Pool Authorizer on API Gateway. Direct uploads to Amazon S3 are enabled by exchanging the user token for temporary AWS credentials via a Cognito Identity Pool, which assumes an authenticated IAM role with the necessary S3 permissions.
Step-by-Step Solution
Key Concept
Amazon Cognito User Pools vs. Identity Pools and API Gateway Authorization