Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Notes on using Cognito with Serverless

  • event.requestContext.identity.cognitoIdentityId should be the user id
  • Cognito User Pools are for handling user registration, authentication, and account recovery
  • Cognito Identity Pools (or Cognito Federated Identities) are a way to authorize users to directly use the various AWS services in your account, such as S3, DynamoDB, and, most relevant for APIs, API Gateway

CloudFormation in serverless.yml

resources:
  Resources:
    CognitoUserPoolMyUserPool: # Where "MyUserPool" is the name of the pool as used elsewhere in serverless.yml
      Type: AWS::Cognito::UserPool
      Properties:
        # Place the rest of the cft here https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.