:doc:`Organizations <../../organizations>` / Client / update_organizational_unit

**************************
update_organizational_unit
**************************



.. py:method:: Organizations.Client.update_organizational_unit(**kwargs)

  

  Renames the specified organizational unit (OU). The ID and ARN don't change. The child OUs and accounts remain in place, and any attached policies of the OU remain attached.

   

  You can only call this operation from the management account.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/organizations-2016-11-28/UpdateOrganizationalUnit>`_  


  **Request Syntax**
  ::

    response = client.update_organizational_unit(
        OrganizationalUnitId='string',
        Name='string'
    )
    
  :type OrganizationalUnitId: string
  :param OrganizationalUnitId: **[REQUIRED]** 

    ID for the OU that you want to rename. You can get the ID from the  ListOrganizationalUnitsForParent operation.

     

    The `regex pattern <http://wikipedia.org/wiki/regex>`__ 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.

    

  
  :type Name: string
  :param Name: 

    The new name that you want to assign to the OU.

     

    The `regex pattern <http://wikipedia.org/wiki/regex>`__ that is used to validate this parameter is a string of any of the characters in the ASCII character range.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'OrganizationalUnit': {
              'Id': 'string',
              'Arn': 'string',
              'Name': 'string'
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **OrganizationalUnit** *(dict) --* 

        A structure that contains the details about the specified OU, including its new name.

        
        

        - **Id** *(string) --* 

          The unique identifier (ID) associated with this OU. The ID is unique to the organization only.

           

          The `regex pattern <http://wikipedia.org/wiki/regex>`__ 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.

          
        

        - **Arn** *(string) --* 

          The Amazon Resource Name (ARN) of this OU.

           

          For more information about ARNs in Organizations, see `ARN Formats Supported by Organizations <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsorganizations.html#awsorganizations-resources-for-iam-policies>`__ in the *Amazon Web Services Service Authorization Reference*.

          
        

        - **Name** *(string) --* 

          The friendly name of this OU.

           

          The `regex pattern <http://wikipedia.org/wiki/regex>`__ that is used to validate this parameter is a string of any of the characters in the ASCII character range.

          
    
  
  **Exceptions**
  
  *   :py:class:`Organizations.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`Organizations.Client.exceptions.AWSOrganizationsNotInUseException`

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

  
  *   :py:class:`Organizations.Client.exceptions.DuplicateOrganizationalUnitException`

  
  *   :py:class:`Organizations.Client.exceptions.InvalidInputException`

  
  *   :py:class:`Organizations.Client.exceptions.OrganizationalUnitNotFoundException`

  
  *   :py:class:`Organizations.Client.exceptions.ServiceException`

  
  *   :py:class:`Organizations.Client.exceptions.TooManyRequestsException`

  

  **Examples**

  The following example shows how to rename an OU. The output confirms the new name:/n/n
  ::

    response = client.update_organizational_unit(
        Name='AccountingOU',
        OrganizationalUnitId='ou-examplerootid111-exampleouid111',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'OrganizationalUnit': {
            'Arn': 'arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examplerootid111-exampleouid111',
            'Id': 'ou-examplerootid111-exampleouid111',
            'Name': 'AccountingOU',
        },
        'ResponseMetadata': {
            '...': '...',
        },
    }

  