A developer is designing a native mobile application that requires users to authenticate. Once logged in, the application must allow users to upload files directly to their own dedicated folders in an Amazon S3 bucket. Additionally, the application must call a backend REST API hosted on Amazon API Gateway that requires user authentication. The developer wants to implement a secure solution that minimizes custom code and management overhead.
Which two configuration steps should the developer perform to meet these requirements? (Select TWO.)
- Create an Amazon Cognito Identity Pool, specify the User Pool as an identity provider, and associate an authenticated IAM role that allows access to user-specific S3 paths.Cevap
- Configure a Cognito User Pool authorizer on the API Gateway REST API, and configure the application to pass the ID token in the authorization header.Cevap
- CConfigure the Amazon Cognito User Pool client settings to directly generate temporary AWS IAM credentials for the client app to access the S3 bucket.
- DCreate a custom API Gateway Lambda authorizer that decodes, parses, and validates the Cognito User Pool token signatures on each API request.
- EDefine the S3 bucket read and write permission statements inside the trust policy document of the IAM role assumed by Cognito authenticated users.
Cevap
Create an Amazon Cognito Identity Pool linked to the User Pool for S3 access, and use a built-in Cognito User Pool authorizer on API Gateway.
The correct options recommend creating an Amazon Cognito Identity Pool and configuring a built-in Cognito User Pool authorizer. Amazon Cognito User Pools handle user directory services, registration, and authentication (generating JWT tokens). Amazon Cognito Identity Pools enable authorization by exchanging these JWT tokens for temporary AWS IAM credentials, which are required for direct interactions with AWS services like Amazon S3. For the REST API on Amazon API Gateway, using the built-in Cognito User Pool authorizer is the most efficient and low-overhead method to validate User Pool tokens (ID tokens) without writing custom Lambda authorizer code.
Adım Adım Çözüm
Anahtar Kavram
Amazon Cognito User Pools vs. Identity Pools and API Gateway Authorization
Tahmini Süre:2m 0s