:doc:`IAM <../../iam>` / Client / delete_user

***********
delete_user
***********



.. py:method:: IAM.Client.delete_user(**kwargs)

  

  Deletes the specified IAM user. Unlike the Amazon Web Services Management Console, when you delete a user programmatically, you must delete the items attached to the user manually, or the deletion fails. For more information, see `Deleting an IAM user <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_manage.html#id_users_deleting_cli>`__. Before attempting to delete a user, remove the following items:

   

  
  * Password ( `DeleteLoginProfile <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteLoginProfile.html>`__)
   
  * Access keys ( `DeleteAccessKey <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteAccessKey.html>`__)
   
  * Signing certificate ( `DeleteSigningCertificate <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteSigningCertificate.html>`__)
   
  * SSH public key ( `DeleteSSHPublicKey <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteSSHPublicKey.html>`__)
   
  * Git credentials ( `DeleteServiceSpecificCredential <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteServiceSpecificCredential.html>`__)
   
  * Multi-factor authentication (MFA) device ( `DeactivateMFADevice <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeactivateMFADevice.html>`__, `DeleteVirtualMFADevice <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteVirtualMFADevice.html>`__)
   
  * Inline policies ( `DeleteUserPolicy <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteUserPolicy.html>`__)
   
  * Attached managed policies ( `DetachUserPolicy <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DetachUserPolicy.html>`__)
   
  * Group memberships ( `RemoveUserFromGroup <https://docs.aws.amazon.com/IAM/latest/APIReference/API_RemoveUserFromGroup.html>`__)
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08/DeleteUser>`_  


  **Request Syntax**
  ::

    response = client.delete_user(
        UserName='string'
    )
    
  :type UserName: string
  :param UserName: **[REQUIRED]** 

    The name of the user to delete.

     

    This parameter allows (through its `regex pattern <http://wikipedia.org/wiki/regex>`__) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

    

  
  
  :returns: None
  **Exceptions**
  
  *   :py:class:`IAM.Client.exceptions.LimitExceededException`

  
  *   :py:class:`IAM.Client.exceptions.NoSuchEntityException`

  
  *   :py:class:`IAM.Client.exceptions.DeleteConflictException`

  
  *   :py:class:`IAM.Client.exceptions.ConcurrentModificationException`

  
  *   :py:class:`IAM.Client.exceptions.ServiceFailureException`

  

  **Examples**

  The following command removes the IAM user named Bob from the current account.
  ::

    response = client.delete_user(
        UserName='Bob',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'ResponseMetadata': {
            '...': '...',
        },
    }

  