📔
ServerlessDocs - Serverless File Service
  • Introduction
  • Why Serverless!!
  • Prerequisites
  • User Management
    • Authentication
    • Amazon Cognito
    • Create the User Pool
    • Create an App Client
    • Integrate the app with Cognito User Pool
    • Create the Identity Pool
    • Validate the setup
    • Troubleshooting
  • Manage Documents with AWS S3
    • Authorization
    • Update Cognito Identity Pool Auth Role
    • S3 Documents Bucket Folder Structure
    • Validate the Access Permissions
    • Public and Private files access
    • Upload Files to S3
    • Download Files
    • Delete Files
    • Share Files
  • More Security Configurations
    • Cognito user emails
    • Password policies
    • Allow only Organization and Whitelisted users to Signup
    • Allow admin users to upload Public files
    • Notify Admin users when a new user signup
    • Enable Multi-factor Authentication (MFA)
  • User Operations
    • Password Reset / Forgot Password
    • Resend Verification Code
  • Serverless APIs
    • APIs
    • Secure APIs using API Gateway Authorizer
    • Access Cognito values in Lambda function
    • Authorize APIs with OAuth 2 Scope
    • Fine-grained Access with AssumeRole
    • Notify Admin users on large file uploads
    • Generate a Month-To-Date Usage report
  • Source Code and Setup
    • Source Code
    • IAM Policies
    • S3 Bucket Policies
    • Suggestions / Feedback
    • More References
  • Deployment
    • AWS SAM
    • Serverless Framework
  • Contributors
    • Team
Powered by GitBook
On this page

Was this helpful?

  1. User Management

Create the Identity Pool

PreviousIntegrate the app with Cognito User PoolNextValidate the setup

Last updated 4 years ago

Was this helpful?

Now, our application is ready but does not have any AWS credentials to use any of the AWS services directly. To allow our application to use AWS services like S3, we will need to configure an Identity pool and assign a role with an authenticated user.

  • Go to the Federated identities from the top-left section in Cognito console

  • Select Create new identity pool

  • Give the identity pool name

  • Open the Authentication providers section

  • Here we will configure the source of our user data, in our case, it would be a Cognito User Pool that we previously created.

  • Copy the User Pool ID and App client id from the app-config.js configuration here

  • Continue the setup with Create Pool

  • Now we will need to attach the IAM Roles to our Identity pool. You will see two roles, one for Authenticated and the next one for Unauthenticated users.

  • Authenticated users are those who have a valid Cognito user pool session after doing the sign-in, and Unauthenticated users are those who are yet to either signup or has a valid user but not yet signed in.

  • We will keep this to default and complete the setup with Allow command at the bottom

  • Copy the Identity pool id and save to app-config.js

Now our app contains both the Cognito user pool and the Cognito identity pool. Move the current changes to the S3 bucket and reload the app. If you are already signed-in then the log should show the token and expiry detail.

Reload the application now and it should work.

Identity Pool for the app
Identity Pool is ready to use