
I Tried Recovering a Deleted User Using Point-in-Time Recovery (PITR) in Amazon Cognito
This page has been translated by machine translation. View original
Introduction
On November 18, 2026, Amazon Cognito added support for point-in-time recovery (PITR).
PITR is a feature that restores the user data of a user pool to its state at a past point in time. In this article, I deleted and modified users and groups in an Essentials plan user pool, and then recovered them with the AWS CLI.
Prerequisites
PITR is enabled automatically for Essentials and Plus user pools. The range you can specify for the recovery point is the past 1 day for Essentials and the past 14 days for Plus.
I used AWS CLI 2.41.1.
The IAM policy must allow the following five actions on the user pool resource. All of them are included in the AmazonCognitoPowerUser managed policy.
cognito-idp:InitiatePointInTimeRecovery
cognito-idp:DescribePointInTimeRecovery
cognito-idp:StartPointInTimeRecovery
cognito-idp:CancelPointInTimeRecovery
cognito-idp:ListPointInTimeRecoveries
Test Data
I created users alice, bob, carol, and dave together with the groups admins and editors, and then performed the following operations.
| User | State at creation | Operation after creation |
|---|---|---|
| alice | Group admins, TOTP MFA | Deleted |
| bob | Group editors | Deleted |
| carol | No group | Updated name to carol-updated, changed password |
| dave | No group | No changes |
| eve | Does not exist | Created (group temp) |
| frank | Does not exist | Created |
After that, I deleted the group editors and created the group temp.
Commands to create the pool and app client
I created the user pool specifying Essentials, and enabled TOTP MFA as OPTIONAL.
aws cognito-idp create-user-pool --pool-name pitr-verify-1119 --user-pool-tier ESSENTIALS --deletion-protection INACTIVE
aws cognito-idp set-user-pool-mfa-config --user-pool-id <USER_POOL_ID> --mfa-configuration OPTIONAL --software-token-mfa-configuration Enabled=true
aws cognito-idp create-user-pool-client --user-pool-id <USER_POOL_ID> --client-name pitr-client --no-generate-secret --explicit-auth-flows ALLOW_USER_PASSWORD_AUTH ALLOW_REFRESH_TOKEN_AUTH
Recovery Steps
Specifying the Recovery Point and Previewing
For initiate, you pass the recovery point as a UTC timestamp (ending in Z). You must specify a time at least 15 minutes before the present. This time, I specified the time right after the creation of the 4 users and the groups.
aws cognito-idp initiate-point-in-time-recovery --user-pool-id <USER_POOL_ID> --restore-timestamp <RESTORE_TIMESTAMP_UTC>
{
"Restoration": {
"RestoreId": "<RESTORE_ID>",
"RestoreStatus": "PREVIEW_GENERATING",
"RestoreTimestamp": "2026-11-19T11:25:10+09:00",
"TriggerTimestamp": "2026-11-19T11:51:12.629000+09:00"
}
}
For the subsequent describe and start, pass the RestoreId from this response.
It took about 16 minutes from initiate until RestoreStatus became PREVIEW_GENERATED.
Use describe to check the preview counts.
aws cognito-idp describe-point-in-time-recovery --user-pool-id <USER_POOL_ID> --restore-id <RESTORE_ID>
{
"Restoration": {
"RestoreId": "<RESTORE_ID>",
"RestoreStatus": "PREVIEW_GENERATED",
"RestoreTimestamp": "2026-11-19T11:25:10+09:00",
"TriggerTimestamp": "2026-11-19T11:51:12.629000+09:00",
"RestorePreview": [
{
"Entity": "Passkeys",
"CreateCount": 0,
"UpdateCount": 0,
"DeleteCount": 0
},
{
"Entity": "User MFAs",
"CreateCount": 1,
"UpdateCount": 0,
"DeleteCount": 0
},
{
"Entity": "Users",
"CreateCount": 2,
"UpdateCount": 1,
"DeleteCount": 2
},
{
"Entity": "Groups",
"CreateCount": 1,
"UpdateCount": 0,
"DeleteCount": 1
}
]
}
}
The CreateCount for Users is the number of deleted users being recreated, and the DeleteCount is the number of users created after the recovery point that will be deleted. The actual differences are as follows.
| Item | Count | Actual difference |
|---|---|---|
| Users create | 2 | Recreate alice and bob |
| Users update | 1 | carol |
| Users delete | 2 | eve, frank |
| Groups create | 1 | editors |
| Groups delete | 1 | temp |
| User MFAs create | 1 | alice's TOTP |
| Passkeys | All 0 | None |
Although admins lost a member because alice was deleted, the UpdateCount for Groups is 0.
Behavior While Reviewing the Preview
These are the results of performing writes, reads, and sign-ins against the user pool while in PREVIEW_GENERATED.
| Operation | Request type | Result |
|---|---|---|
| AdminCreateUser, AdminUpdateUserAttributes, CreateGroup | Signed request | ValidationException: Cannot modify user pool resources while point-in-time recovery is in progress. |
| ListUsers, AdminGetUser | Signed request | Success |
| InitiateAuth (dave, who has no MFA configured) | Request from the user | Success |
| UpdateUserAttributes, ChangePassword, SignUp | Request from the user | ForbiddenException: A required service is currently unavailable. If this issue persists, contact your administrator. |
The error message for requests from users does not reveal that a recovery is in progress.
Starting the Recovery
After checking the preview, run start.
aws cognito-idp start-point-in-time-recovery --user-pool-id <USER_POOL_ID> --restore-id <RESTORE_ID>
The RestoreStatus in the start response was RESTORING. I first confirmed RESTORE_COMPLETED about 70 seconds after start.
Recovery Results
What Was Restored
| Item | At the recovery point | Just before recovery (after changes) | After recovery |
|---|---|---|---|
| alice's sub | 5774ead8… | No user | 5774ead8… |
| bob's sub | 47342a18… | No user | 47342a18… |
| alice's sign-in | Success (with TOTP challenge) | UserNotFoundException | Succeeded with the original password. Completed the challenge with a TOTP code registered before the recovery point |
| bob's sign-in | Success | UserNotFoundException | Succeeded with the original password |
| Group membership | alice in admins, bob in editors | Neither alice nor bob exists | alice in admins, bob in editors |
| Group list | admins, editors | admins, temp | admins, editors |
| carol's name | carol | carol-updated | carol |
| eve | Does not exist | Exists | UserNotFoundException |
| frank | Does not exist | Exists | UserNotFoundException |
| dave | Exists | No changes | No changes |
Changed Passwords Are Preserved
As stated in the Developer Guide, PITR does not revert password changes. The user who changed the password (carol) was able to sign in with the changed password.
Summary
Amazon Cognito user pools now support PITR.
Previously, to recover user data after an operational mistake, you had no choice but to use a backup and recovery mechanism you prepared yourself. Recovered users had to reset their passwords, and their sub values were also new ones. With PITR, you can now restore to a specified point in time while preserving passwords and sub values.
It is effective as a means of recovering user data in production environments, but pool settings, app clients, IdPs, and so on are out of scope. In addition, writes to the user pool are rejected while the preview is being reviewed, and generating the preview took about 16 minutes this time.
I recommend trying recovery in an evaluation environment beforehand, understanding the impact and the time required, and then using it.
