Denying a Sign-up request in Cognito User Pools
You can return a empty dict from the lambda to deny sign up request. Similarly you return the event value itself to accept the sign up request.
def lambda_handler(event, context):
if denySignUp:
return {}
else:
return event
You can deny signup by throwing an exception, as shown here.
The exception message will be passed back to Cognito, and on to the client, in the form of a validation error with the message PreSignUp failed with error {exceptionMessage}.
.