Skip to main content

organizational_units

Creates, updates, deletes, gets or lists an organizational_units resource.

Overview

Nameorganizational_units
TypeResource
Idaws.organizations.organizational_units

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
arnstringThe 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. (pattern: <code>^arn:aws:organizations::\d{12}:ou/o-[a-z0-9]{10,32}/ou-[0-9a-z]{4,32}-[0-9a-z]{8,32}</code>)
idstringThe 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. (pattern: <code>^ou-[0-9a-z]{4,32}-[a-z0-9]{8,32}$</code>)
namestringThe 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. (pattern: <code>[\s\S]*</code>)
pathstringThe path in the organization where this OU exists. (pattern: <code>^(o-[a-z0-9]{10,32}/r-[0-9a-z]{4,32}(/ou-[0-9a-z]{4,32}-[a-z0-9]{8,32})(/\d{12}))/</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_organizational_unitselectregionRetrieves information about an organizational unit (OU). You can only call this operation from the management account or a member account that is a delegated administrator.
create_organizational_unitinsertregion, ParentId, NameCreates an organizational unit (OU) within a root or parent OU. An OU is a container for accounts that enables you to organize your accounts to apply policies according to your business requirements. The number of levels deep that you can nest OUs is dependent upon the policy types enabled for that root. For service control policies, the limit is five. For more information about OUs, see Managing organizational units (OUs) in the Organizations User Guide. If the request includes tags, then the requester must have the organizations:TagResource permission. You can only call this operation from the management account.
update_organizational_unitupdateregion, OrganizationalUnitIdRenames 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.
delete_organizational_unitdeleteregionDeletes 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. You can only call this operation from the management account.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Retrieves information about an organizational unit (OU). You can only call this operation from the management account or a member account that is a delegated administrator.

SELECT
arn,
id,
name,
path
FROM aws.organizations.organizational_units
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates an organizational unit (OU) within a root or parent OU. An OU is a container for accounts that enables you to organize your accounts to apply policies according to your business requirements. The number of levels deep that you can nest OUs is dependent upon the policy types enabled for that root. For service control policies, the limit is five. For more information about OUs, see Managing organizational units (OUs) in the Organizations User Guide. If the request includes tags, then the requester must have the organizations:TagResource permission. You can only call this operation from the management account.

INSERT INTO aws.organizations.organizational_units (
ParentId,
Name,
Tags,
region
)
SELECT
'{{ ParentId }}' /* required */,
'{{ Name }}' /* required */,
'{{ Tags }}',
'{{ region }}'
RETURNING
organizational_unit
;

UPDATE examples

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.

UPDATE aws.organizations.organizational_units
SET
OrganizationalUnitId = '{{ OrganizationalUnitId }}',
Name = '{{ Name }}'
WHERE
region = '{{ region }}' --required
AND OrganizationalUnitId = '{{ OrganizationalUnitId }}' --required
RETURNING
organizational_unit;

DELETE examples

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. You can only call this operation from the management account.

DELETE FROM aws.organizations.organizational_units
WHERE region = '{{ region }}' --required
;