:doc:`Role <index>` / Action / delete

******
delete
******



.. py:method:: IAM.Role.delete()

  

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

   

  
  * Inline policies ( `DeleteRolePolicy <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteRolePolicy.html>`__)
   
  * Attached managed policies ( `DetachRolePolicy <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DetachRolePolicy.html>`__)
   
  * Instance profile ( `RemoveRoleFromInstanceProfile <https://docs.aws.amazon.com/IAM/latest/APIReference/API_RemoveRoleFromInstanceProfile.html>`__)
   
  * Optional – Delete instance profile after detaching from role for resource clean up ( `DeleteInstanceProfile <https://docs.aws.amazon.com/IAM/latest/APIReference/API_DeleteInstanceProfile.html>`__)
  

   

  .. warning::

     

    Make sure that you do not have any Amazon EC2 instances running with the role you are about to delete. Deleting a role or instance profile that is associated with a running instance will break any applications running on the instance.

    

  

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


  **Request Syntax**
  ::

    response = role.delete()
    
    
  
  :returns: None