A fitness app for mobile devices lets members sign up and sign in with an email address and password.
After sign-in, the app must read and write the member's own folder in an Amazon S3 bucket, using temporary AWS credentials that cover only that folder. The app must not hold any AWS keys.
Which Amazon Cognito setup meets these requirements?
Choose one answer.
AA. A user pool only, with the app sending the user pool ID token to S3 with each request, so that S3 can check the member's folder.
BB. A user pool for sign-in, and an identity pool that exchanges the tokens for temporary credentials of a role limited to the member's folder.
CC. An identity pool only, with members signing up directly in the identity pool using their email address and password, and getting credentials at once.
DD. A user pool with an app client secret built into the app, and that secret used to sign every S3 request made on the member's behalf.
Show the answer and explanation
Answer: B
A. Wrong: S3 does not accept Cognito tokens. AWS service calls must be signed with AWS credentials, and a user pool alone does not provide those.
B. Right: Correct. The user pool authenticates the member and issues tokens. The identity pool trades those tokens for temporary AWS credentials, using a role whose policy covers only that member's folder. Learn more: Amazon Cognito identity pools (opens in a new tab)
C. Wrong: Identity pools do not hold a user directory or handle sign-up. They trust identities from providers such as user pools and issue AWS credentials for them.
D. Wrong: An app client secret authenticates the app to the user pool. It is not an AWS credential, and it must not be built into a mobile app.
Explanation
User pools answer who the user is by authenticating them and issuing tokens. Identity pools answer what AWS resources the user may use, by exchanging a trusted token for temporary credentials with a limited role. Apps that call AWS services directly usually combine the two.
The user pool says who the member is. The identity pool turns that into short-lived credentials for one folder.
Want more on Amazon Cognito and federated access? The 5 full-length practice sets have 15 more Amazon Cognito and federated access questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →