Organizations / Client / delete_organizational_unit
delete_organizational_unit#
- Organizations.Client.delete_organizational_unit(**kwargs)#
- Deletes an organizational unit (OU) from a root or another OU. You must first remove all accounts and child OUs from the OU that you want to delete. - This operation can be called only from the organization’s management account. - See also: AWS API Documentation - Request Syntax- response = client.delete_organizational_unit( OrganizationalUnitId='string' ) - Parameters:
- OrganizationalUnitId (string) – - [REQUIRED] - The unique identifier (ID) of the organizational unit that you want to delete. You can get the ID from the ListOrganizationalUnitsForParent operation. - The regex pattern for an organizational unit ID string requires “ou-” followed by from 4 to 32 lowercase letters or digits (the ID of the root that contains the OU). This string is followed by a second “-” dash and from 8 to 32 additional lowercase letters or digits. 
- Returns:
- None 
 - Exceptions- Organizations.Client.exceptions.AccessDeniedException
- Organizations.Client.exceptions.AWSOrganizationsNotInUseException
- Organizations.Client.exceptions.ConcurrentModificationException
- Organizations.Client.exceptions.InvalidInputException
- Organizations.Client.exceptions.OrganizationalUnitNotEmptyException
- Organizations.Client.exceptions.OrganizationalUnitNotFoundException
- Organizations.Client.exceptions.ServiceException
- Organizations.Client.exceptions.TooManyRequestsException
 - Examples- The following example shows how to delete an OU. The example assumes that you previously removed all accounts and other OUs from the OU: - response = client.delete_organizational_unit( OrganizationalUnitId='ou-examplerootid111-exampleouid111', ) print(response) - Expected Output: - { 'ResponseMetadata': { '...': '...', }, }