# How to define Cognito UserMigration trigger?

**URL:** <https://forum.serverless.com/t/how-to-define-cognito-usermigration-trigger/10485>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [February 7, 2020, 8:57am UTC](https://forum.serverless.com/t/how-to-define-cognito-usermigration-trigger/10485 "2020-02-07T08:57:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![morgler](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/morgler/32/3962_2.png) [@morgler](https://forum.serverless.com/u/morgler)\
**Post date:** [February 7, 2020, 8:57am UTC](https://forum.serverless.com/t/how-to-define-cognito-usermigration-trigger/10485/1 "2020-02-07T08:57:18Z")

</div>

I’m trying to set a UserMigration trigger for Cognito. The PR [https://github.com/serverless/serverless/pull/6511](https://github.com/serverless/serverless/pull/6511) says how to configure it, but I just cannot get it to work. Although the Cognito UserPool is created and the Lambda function is uploaded, the trigger is not connected to Cognito.

Here is my function declaration:

```
functions:
  migrateUsers:
    handler: functions/users.migrate
    name: migrateUsers-${self:custom.myStage}
    description: Migrates Gixtra users to Cognito upon signup/signin
    events:
      - cognitoUserPool:
        pool: MyUserPool
        trigger: UserMigration
        existing: true

```

And here is the UserPool:

```
resources:
  Resources:
    CognitoUserPoolMyUserPool:
    Type: AWS::Cognito::UserPool
    Properties:
      UserPoolName: ${self:custom.userPoolName}
      UsernameAttributes:
        - email
      AutoVerifiedAttributes:
        - email

```

I have tried to reference the UserPool in the “trigger” as MyUserPool, CognitoUserPoolMyUserPool and cognitoUserPoolMyUserPool. Whatever I try, the trigger is never set.

Any hints at what I do wrong are appreciated.
