Skip to content

Instantly share code, notes, and snippets.

@danmactough
Last active February 10, 2018 18:15
Show Gist options
  • Save danmactough/3aa95d07b1d14d9d55fbad987e3c7627 to your computer and use it in GitHub Desktop.
Save danmactough/3aa95d07b1d14d9d55fbad987e3c7627 to your computer and use it in GitHub Desktop.

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