Users, federation, and temporary access
DVA-C03 · Lesson 11 of 24 · 1:31:27
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the DVA-C03 exam (AWS Certified Developer – Associate). In this lesson: Cognito user pools and JWT tokens, MFA, API Gateway authorizers, identity pools and web identity federation, fine-grained access with policy variables, S3 presigned URLs, and CloudFront signed URLs and cookies. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Millions of fans, no IAM users
AnyCompany Tickets has millions of fans, and none of them will ever get an IAM user. Fans sign in to the app, upload a profile photo, and download their own tickets, and each of them must only reach their own data. This lesson covers Cognito user pools and tokens, identity pools and federation, fine-grained access, and temporary access with presigned and signed URLs.
User pools and tokens
An Amazon Cognito user pool is a user directory: sign-up, sign-in, password policies, and federation with social and enterprise identity providers. After sign-in, it returns JSON Web Tokens: an ID token with claims about the user, an access token with scopes and groups, and a refresh token to get new tokens. Multi-factor authentication, or MFA, adds a second factor, by SMS, by email, or with a time-based one-time password from an authenticator app. API Gateway checks the tokens with a Cognito authorizer, or a JWT authorizer for HTTP APIs, before any code runs. Code that checks a token itself verifies its signature with the pool's public keys, its expiry, and its audience.
Identity pools and federation
When the app must call AWS services directly, like uploading a photo to S3, it needs AWS credentials, not just a token. A Cognito identity pool exchanges a token from a user pool, or from another identity provider, for temporary AWS credentials. Each user gets a role, one for authenticated users and another for guests, through web identity federation with AWS STS. So the app holds short-lived credentials, limited by the role, and no long-term key ever ships inside the app.
Fine-grained access
With one role for millions of users, each user must still reach only their own data. Policy variables do that: the identity ID of the user, placed in the S3 prefix, limits each user to their own folder. In DynamoDB, a condition on leading keys limits each user to the items whose partition key is their own ID. And an API can read the groups and scopes in the access token, to allow an action, like a refund, to staff only.
Presigned and signed URLs
A presigned URL gives time-limited access to one S3 object, to download or to upload it, without any AWS credentials on the client. The backend signs it with its own credentials, and anyone who has the URL can use it until it expires. It lasts up to seven days when an IAM user signs it, and never longer than the role session that signed it. For content served by CloudFront, a signed URL protects one file, and signed cookies protect many files, like every song of an album. And origin access control keeps the bucket private, so that fans cannot go around CloudFront.
Choosing the access method
Each need has its tool. Fans who sign in need a user pool, and fans who call AWS directly need an identity pool behind it. One object for a short while calls for a presigned URL, and many files through CloudFront call for signed cookies. And each user's own rows or folders come from policy variables and leading keys.
Recap
Let's recap. A Cognito user pool signs users in, with MFA if needed, and returns ID, access, and refresh tokens. API Gateway checks those tokens with a Cognito or JWT authorizer, and code verifies the signature, the expiry, and the audience. An identity pool exchanges tokens for temporary AWS credentials, through web identity federation. Policy variables and leading keys give each user their own data, with one role for everyone. And presigned URLs open one S3 object for a while, while CloudFront signed URLs and cookies protect content at the edge.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Signed-in fans must upload their profile photos straight from the mobile app to S3, without going through the backend, and without any key built into the app. What should the developer use?
- An IAM user’s access key built into the app
- The ID token from the Cognito user pool
- A Cognito identity pool with an upload role
- An API key from an API Gateway usage plan
Show the answer
A Cognito identity pool with an upload role
An identity pool trades the fan's token for temporary credentials of a role that can upload photos. “An IAM user’s access key built into the app” would ship a long-term key inside every copy of the app. “The ID token from the Cognito user pool” would authenticate the fan, but its tokens are not AWS credentials, so S3 would refuse them. And “An API key from an API Gateway usage plan” would identify the app, without signing any request to S3.
After an order, the buyer must be able to download the ticket PDF for fifteen minutes. The bucket stays private, and the buyer has no AWS credentials. What should the backend return?
- A presigned URL that expires in fifteen minutes
- A public link, after a change to the bucket policy
- Temporary AWS credentials for the buyer
- The access token of the buyer’s session
Show the answer
A presigned URL that expires in fifteen minutes
A presigned URL for the PDF, set to expire in 15 minutes, gives access to that one object only. “A public link, after a change to the bucket policy” would make every ticket readable by anyone, for good. “Temporary AWS credentials for the buyer” would hand AWS credentials to the buyer, far more than one file needs. And “The access token of the buyer’s session” would give the buyer a token, which S3 does not accept.
Subscribers to the backstage pass can watch about two hundred short videos, all served by CloudFront. The team does not want to sign each link one by one. What should the developer use?
- A CloudFront signed URL for every video
- A public bucket with hard-to-guess names
- S3 presigned URLs for every video
- CloudFront signed cookies for subscribers
Show the answer
CloudFront signed cookies for subscribers
Signed cookies give access to many files through CloudFront, without changing each link. “A CloudFront signed URL for every video” would sign every link one by one, which the team wants to avoid. “A public bucket with hard-to-guess names” would skip CloudFront, and make the videos public. And “S3 presigned URLs for every video” would sign links to S3, around CloudFront, one object at a time.