If you are using "Amazon Cognito Sync":
Amazon Cognito raises the Sync Trigger event when a dataset is synchronized. You can use the Sync Trigger event to take an action when a user is updated or deleted.
Please have a look on below official document for more information and steps.
Ref: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-events.html
Records updated by the app user will have the 'op' field set as “replace” and the records deleted will have 'op' field as "remove".
According to above point in referenced documentation op field can help you to identify operation, So if value is "removed" in op then you can perform your actions for your business logic requirement.
If you are not using "Amazon Cognito Sync":
- Create user records in DynamoDB table "user" using Post Confirmation Lambda Trigger.
- Build your own user listing based on DynamoDB table "user".
- Build your own user delete api using lambda function and aws api gateway.
- You lambda function should handle delete user from cognito & also your business logic that you want to perform.
DeleteUser
orAdminDeleteUser
events are sent to cloudtrail: docs.aws.amazon.com/cognito/latest/developerguide/… However, if your app is logging to CloudWatch, you might be able to insert your own events for triggering. – ashtonium