private async createUserPool()

in services/shared/apps/tenant-registration/src/idp-service/idp.service.ts [121:171]


  private async createUserPool(poolName: string, path: string) {
    const host = process.env.SERVICE_ADDRESS;
    const client = new CognitoIdentityProviderClient({});

    const command = new CreateUserPoolCommand({
      PoolName: poolName,
      AdminCreateUserConfig: {
        AllowAdminCreateUserOnly: true,
        InviteMessageTemplate: {
          EmailMessage: `<b>Welcome to the SaaS Application for EKS Workshop!</b> <br>
    <br>
    The URL for your application is here: <a href="http://${host}/${path}/index.html">http://${host}/${path}/index.html</a>. 
    <br>
    <br>
    Please note that it may take a few minutes to provision your tenant. If you get a 404 when hitting the link above
    please try again in a few minutes. You can also check the AWS CodePipeline project that's in your environment
    for status.
    <br>
    Your username is: <b>{username}</b>
    <br>
    Your temporary password is: <b>{####}</b>
    <br>`,
          EmailSubject:
            'Temporary password for environment EKS SaaS Application',
        },
      },
      UsernameAttributes: ['email'],
      Schema: [
        {
          AttributeDataType: 'String',
          Name: 'email',
          Required: true,
          Mutable: true,
        },
        {
          AttributeDataType: 'String',
          Name: 'tenant-id',
          Required: false,
          Mutable: false,
        },
        {
          AttributeDataType: 'String',
          Name: 'company-name',
          Required: false,
          Mutable: false,
        },
      ],
    });
    const response = await client.send(command);
    return response.UserPool;
  }