Customizing
User Pool Workflows by Using AWS Lambda Triggers

You can use AWS Lambda triggers with Amazon Cognito user pools to customize workflows
at various
stages in the lifecycle of a user account. For more information, see the
AWS Lambda Developer Guide.

Important

When called, your Lambda function must respond within 5 seconds. If it does not, Amazon
Cognito
retries the call. After 3 unsuccessful attempts, Amazon Cognito times out. This 5-second
timeout
value cannot be changed.

Amazon Cognito invokes this trigger before sending an email or phone verification
message or a multi-factor authentication (MFA) code, allowing you to customize
the message dynamically. Static custom messages can be edited in the
Message Customizations tab of the Amazon Cognito console.

Pre sign-up

Amazon Cognito invokes this trigger when a user attempts to register (sign up),
allowing you to perform custom validation to accept or deny the registration
request.

Pre authentication

Amazon Cognito invokes this trigger when a user attempts to authenticate (sign in),
allowing you to perform custom validation to accept or deny the authentication
request.

Post authentication

Amazon Cognito invokes this trigger after authenticating a user, allowing you to add
custom logic.

Post confirmation

Amazon Cognito invokes this trigger after a user is confirmed, allowing you to send
custom messages or to add custom logic. For example, you may want to implement
analytics in your app.

Amazon Cognito invokes this trigger when a user does not exist in the user pool at
the
time of sign-in with a password, or in the forgot-password flow. After the
Lambda function returns successfully, Amazon Cognito creates the user in the user
pool.
For details on the authentication flow with user migration Lambda trigger see
Importing Users into User Pools With
a User Migration Lambda Trigger.

Javascript is disabled or is unavailable in your browser.

To use the AWS Documentation, Javascript must be enabled. Please refer to your browser's
Help pages for instructions.