Delete an IAM user
Delete an IAM user or service account, with its group memberships, role assignments and policy attachments.
Replace user-id with the IAM user's id.
Warning
Deleting cannot be undone. Anything that authenticates as the user, such as its access keys, loses access at once.
Deleting a person's IAM user also removes the person from the organization, exactly as removing the member does: the membership is suspended, their console sessions end and the apps they connected to the organization are disconnected. To take a person's access away while keeping their IAM user as a record, remove them from the organization instead; see Manage members.
Prerequisites
- Permission for
iam:DeleteUseron the user. For a person's IAM user, alsoiam:RemoveMember. - For the console, also
iam:ListUsersto open Users, andiam:GetUseron the user: its page answers 404 without it.
Delete the user
- Open Identity, choose Users, then the user.
- Choose Danger zone, then Delete IAM user.
- Type the user name and confirm.
dcloud iam users delete user-idDELETE /iam/api/users/3f8b6c2e-1d4a-4b7e-9c2f-5a6b7c8d9e0fRemove the dcloud_iam_user resource from your configuration and apply.
Result
The user, its group memberships, its role assignments and its policy attachments are gone. The policies themselves stay. When the user signed in to the console with a user name, that sign-in is deleted with it.
If the deletion is refused
- 404
IAM user not foundfor an id that is not an IAM user of your organization. - 409
This is the organization owner's IAM user and cannot be deleted: the owner holdsAdministratorAccessthrough it. - 403 for a person's IAM user when you have
iam:DeleteUserbut notiam:RemoveMember. Nothing is changed.