Organizations / Client / update_organizational_unit

update_organizational_unit#

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.

This operation can be called only from the organization’s management account.

See also: AWS API Documentation

Request Syntax

response = client.update_organizational_unit(
    OrganizationalUnitId='string',
    Name='string'
)
Parameters:
  • OrganizationalUnitId (string) –

    [REQUIRED]

    The unique identifier (ID) of the OU that you want to rename. 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.

  • Name (string) –

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

    The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

Return type:

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 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 in the Amazon Web Services Service Authorization Reference.

      • Name (string) –

        The friendly name of this OU.

        The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

Exceptions

  • Organizations.Client.exceptions.AccessDeniedException

  • Organizations.Client.exceptions.AWSOrganizationsNotInUseException

  • Organizations.Client.exceptions.ConcurrentModificationException

  • Organizations.Client.exceptions.DuplicateOrganizationalUnitException

  • Organizations.Client.exceptions.InvalidInputException

  • Organizations.Client.exceptions.OrganizationalUnitNotFoundException

  • Organizations.Client.exceptions.ServiceException

  • 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': {
        '...': '...',
    },
}