使用建立組織單位 (OU) AWS Organizations - AWS Organizations

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用建立組織單位 (OU) AWS Organizations

登入您的組織的管理帳戶時,您可以在組織的根建立一個 OU。OUs最多可以嵌套五層深度。若要建立您的第一個 OU,請完成以下步驟。

重要

如果使用管理此組織 AWS Control Tower,然後OUs使用 AWS Control Tower 控制台或APIs。如果您在 [Organizations] 中建立 OU,則該 OU 不會註冊於 AWS Control Tower。 如需詳細資訊,請參閱參照以外的資源 AWS Control Tower 中的 AWS Control Tower 使用者指南

最低許可

若要在您的組織的根帳戶內建立 OU,您必須擁有以下許可:

  • organizations:DescribeOrganization – 僅在使用 Organizations 主控台時才需要

  • organizations:CreateOrganizationalUnit

建立組織單位 (OU)
  1. 登入 AWS Organizations 控制台。您必須以IAM使用者身分登入、擔任IAM角色,或以 root 使用者身分登入 (不建議) 在組織的管理帳戶中。

  2. 導覽至 。AWS 帳戶頁面。

    主控台會顯示根及其內容。當您第一次訪問根目錄時,控制台會顯示您的所有內容 AWS 帳戶 在該頂層視圖中。如果您先前已建立帳戶OUs並將其移至其中,主控台只會顯示最上層OUs和您尚未移入 OU 的任何帳戶。

  3. (選擇性) 如果您要在現有 OU 內建立 OU,請選擇子 OU 的名稱 (不是核取方塊),或在樹狀檢視OUs中選擇 下一個,直到看到想要的名稱,然後選擇其名稱,以瀏覽至子 OU。

  4. 當您在階層中選取正確的父 OU 時,請在 Actions (動作) 選單的 Organizational Unit (組織單位) 下方,選擇 Create new (建立新的)

  5. Create organizational unit (建立組織單位) 對話方塊中,輸入您要建立的 OU 名稱。

  6. (選用) 選擇 Add tag (新增標籤),然後輸入一個鍵和一個選用值,來新增一個或多個標籤。將值留空會將其設定為空白字串;而不是 null。您可以在 OU 中連接最多 50 個標籤。

  7. 最後,選擇 Create organizational unit (建立組織單位)。

您的新 OU 會顯示在父系內。您現在可以將帳戶移至此 OU,或將政策連接至此 OU。

若要建立 OU

下列程式碼範例會示範如何使用CreateOrganizationalUnit

.NET
AWS SDK for .NET
注意

還有更多關於 GitHub。尋找完整的範例,並瞭解如何設定和執行 AWS 代碼示例存儲庫

using System; using System.Threading.Tasks; using Amazon.Organizations; using Amazon.Organizations.Model; /// <summary> /// Creates a new organizational unit in AWS Organizations. /// </summary> public class CreateOrganizationalUnit { /// <summary> /// Initializes an Organizations client object and then uses it to call /// the CreateOrganizationalUnit method. If the call succeeds, it /// displays information about the new organizational unit. /// </summary> public static async Task Main() { // Create the client object using the default account. IAmazonOrganizations client = new AmazonOrganizationsClient(); var orgUnitName = "ProductDevelopmentUnit"; var request = new CreateOrganizationalUnitRequest { Name = orgUnitName, ParentId = "r-0000", }; var response = await client.CreateOrganizationalUnitAsync(request); if (response.HttpStatusCode == System.Net.HttpStatusCode.OK) { Console.WriteLine($"Successfully created organizational unit: {orgUnitName}."); Console.WriteLine($"Organizational unit {orgUnitName} Details"); Console.WriteLine($"ARN: {response.OrganizationalUnit.Arn} Id: {response.OrganizationalUnit.Id}"); } else { Console.WriteLine("Could not create new organizational unit."); } } }
CLI
AWS CLI

在根 OU 或父系 OU 中建立 OU

下列範例顯示如何建立名為 [帳戶組織單位] 的 OU:

aws organizations create-organizational-unit --parent-id r-examplerootid111 --name AccountingOU

輸出包含一個 organizationalUnit 物件,其中包含有關新 OU 的詳細資訊:

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