A developer is building a serverless web application that allows users to authenticate using external social identity providers (Google and Apple). After logging in, users must be able to upload files directly to a private Amazon S3 bucket. The frontend application runs in the user's browser.
Which two steps should the developer perform to configure authentication and authorization for this application? (Select TWO.)
- Configure an Amazon Cognito user pool with Google and Apple as social identity providers to manage user authentication and issue identity tokens.Answer
- Configure an Amazon Cognito identity pool using the user pool as an identity provider, and link it to an authenticated IAM role that permits S3 PutObject operations.Answer
- CConfigure an Amazon Cognito user pool to directly issue temporary AWS credentials to the frontend client, and attach an IAM policy with S3 write permissions to the user pool client.
- DConfigure an Amazon API Gateway REST API with a custom Lambda authorizer that validates the authentication tokens, assumes an IAM role using AWS STS, and returns temporary AWS credentials to the client.
- EConfigure an IAM role with S3 write permissions, edit its trust policy to trust the Amazon S3 service principal, and assign this role directly to the Amazon Cognito user pool.
Answer
The correct configurations are to configure an Amazon Cognito user pool with Google and Apple as social identity providers to manage user authentication, and configure an Amazon Cognito identity pool using the user pool as an identity provider linked to an authenticated IAM role that permits S3 PutObject operations.
To support authentication with external social providers and direct access to AWS resources like Amazon S3 from a client-side application, a combination of Amazon Cognito user pools and identity pools is required. The user pool acts as the user directory and manages federation with Google and Apple, returning identity tokens upon successful login. The identity pool then exchanges these tokens for temporary AWS credentials by assuming an authenticated IAM role. This IAM role contains the permission policy permitting write access to S3, and its trust policy allows the identity pool service to assume the role.
Step-by-Step Solution
Key Concept
Separation of authentication and authorization using Amazon Cognito User Pools and Identity Pools.