Is it possible to trigger a lambda when a user is added in a user pool (any one) via an EventBridge rule ?
Is it possible to trigger a lambda when a user is added in a user pool (any one) via an EventBridge rule ?
It is possible to log AWS Cognito in CloudTrail and then use EventBridge to trigger a lambda based on calls in AWS CloudTrail API from AWS Cognito.
List of support operations to filter the lambda trigger,supported operations.
You could also set a lambda as a trigger in AWS Cognito for a Pre sign-up or Pre-authentication on every user action instead of using Event Bridge.
As stated in the documentation Customizing user pool workflows with Lambda triggers:
You can create an AWS Lambda function and then trigger that function during user pool operations such as user sign-up, confirmation, and sign-in (authentication) with a Lambda trigger. You can add authentication challenges, migrate users, and customize verification messages.
To link a lambda as a trigger in AWS Cognito:
- Create your lambda if does not exist.
- In AWS Cognito, choose an existing user pool from the list, or create a user pool.
- In your user pool, choose the Triggers tab from the navigation bar.
- Choose a Lambda trigger, such as Pre sign-up or Pre-authentication, and then choose your Lambda function (Created before in AWS Lambda) from the Lambda function drop-down list.
- Choose Save changes.