

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# を使用した組織単位 (OU) の作成 AWS Organizations
<a name="create_ou"></a>

組織の管理アカウントにサインインすると、組織のルートに OU を作成できます。OU は、最大 5 レベルの深さまでネストできます。OU を作成するには、次のステップを完了します。

**重要**  
この組織が で管理されている場合は AWS Control Tower、 AWS Control Tower コンソールまたは APIs を使用して OUs を作成します。Organizations で OU を作成すると、その OU は に登録されません AWS Control Tower。詳細については、*AWS Control Tower ユーザーガイド*の [AWS Control Tower外のリソースを参照する](https://docs.aws.amazon.com/controltower/latest/userguide/external-resources.html#ungoverned-resources)を参照してください。

**最小アクセス許可**  
組織のルート内に OU を作成するには、次のアクセス権限が必要です。  
`organizations:DescribeOrganization` - Organizations コンソールを使用する場合にのみ必要
`organizations:CreateOrganizationalUnit`

## AWS マネジメントコンソール
<a name="create_ou_console"></a>

**OU を作成するには**

1. [AWS Organizations コンソール](https://console.aws.amazon.com/organizations/v2)にサインインします。組織の管理アカウントで、IAM ユーザーとしてサインインするか、IAM ロールを引き受けるか、ルートユーザー ([非推奨](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) としてサインインする必要があります。

1. **[AWS アカウント](https://console.aws.amazon.com/organizations/v2/home/accounts)** ページに移動します。

   ルート OU とその内容がコンソールに表示されます。初めてルートにアクセスするときは、コンソールの最上位のビューにすべての AWS アカウント が表示されます。以前に OU を作成してその OU にアカウントを移動している場合、コンソールには最上位の OU と、OU に移動していないアカウントのみ表示されます。

1. (オプション) 既存の OU 内に OU を作成する場合は、[子 OU に移動](navigate_tree.md)します。移動するには、子 OU の名前 (チェックボックスではなく) を選択するか、ツリービューで OU の横の ![\[Gray cloud icon with an arrow pointing downward, indicating download or cloud storage.\]](http://docs.aws.amazon.com/ja_jp/organizations/latest/userguide/images/expand-icon.png) を選択して目的の OU が表示されるまで展開し、目的の子 OU の名前を選択します。

1. 階層内の正しい親 OU を選択したら、[**Actions**] (アクション) メニューの [**Organizational Unit**] (組織単位) で [**Create new**] (新規作成) を選択します。

1. [**Create organizational unit**] (組織単位の作成) ダイアログボックスで、作成する OU の名前を入力します。

1. (オプション) [**Add tag**] (タグの追加) を選択してキーとオプションの値を入力し、1 つ以上のタグを追加します。値を空白のままにすると、空の文字列が設定され、`null` にはなりません。1 つの OU に最大 50 個のタグをアタッチできます。

1. 最後に、[**Create organizational unit**] (組織単位の作成) を選択します。

親 OU 内に新しい OU が作成されます。これで、[この OU にアカウントを移動する](move_account_to_ou.md)、またはポリシーをアタッチすることができるようになりました。

## AWS CLI & AWS SDKs
<a name="create_ou_cli_sdk"></a>

**OU を作成するには**

次のサンプルコードは、`CreateOrganizationalUnit` を使用する方法を説明しています。

------
#### [ .NET ]

**SDK for .NET**  
 GitHub には、その他のリソースもあります。用例一覧を検索し、[AWS コード例リポジトリ](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv3/Organizations#code-examples)での設定と実行の方法を確認してください。

```
    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.");
            }
        }
    }
```
+  API の詳細については、*AWS SDK for .NET API リファレンス*の「[CreateOrganizationalUnit](https://docs.aws.amazon.com/goto/DotNetSDKV3/organizations-2016-11-28/CreateOrganizationalUnit)」を参照してください。

------
#### [ CLI ]

**AWS CLI**  
**ルート OU または親 OU に OU を作成するには**  
次の例は、AccountingOU という名前の OU を作成する方法を示しています。  

```
aws organizations create-organizational-unit --parent-id r-examplerootid111 --name AccountingOU
```
出力には、新しい OU に関する詳細を含む organizationalUnit オブジェクトが含まれます。  

```
{
        "OrganizationalUnit": {
                "Id": "ou-examplerootid111-exampleouid111",
                "Arn": "arn:aws:organizations::111111111111:ou/o-exampleorgid/ou-examplerootid111-exampleouid111",
                "Name": "AccountingOU"
        }
}
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[CreateOrganizationalUnit](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/organizations/create-organizational-unit.html)」を参照してください。**

------