

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

# 使用 建立組織 AWS Organizations
<a name="orgs_manage_org_create"></a>

您可以使用 AWS 帳戶 做為管理帳戶來建立組織。當您建立組織時，您可以選擇該組織是否支援[所有功能 （建議） ](orgs_getting-started_concepts.md#feature-set-all)或僅[支援合併帳單](orgs_getting-started_concepts.md#feature-set-cb-only)。根據預設，您建立的組織支援所有功能。

## 建立組織
<a name="create-org"></a>

您可以使用 或使用來自 AWS 管理主控台 或 AWS CLI 其中一個 SDK APIs命令來建立組織。

**最低許可**  
若要使用您目前的 建立組織 AWS 帳戶，您必須具有下列許可：  
`organizations:CreateOrganization`
`iam:CreateServiceLinkedRole`   
您可以將此許可限制為僅限服務委託人 `organizations.amazonaws.com`。

### AWS 管理主控台
<a name="create-org-console"></a>

**建立組織**

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. 在預設情況下，您建立的組織會啟用所有功能。但是，您可以選擇下列其中一個步驟：
   + 若要建立已啟用所有功能的組織，在簡介頁面上，選擇 **Create an organization** (建立組織)。
   + 若要建立僅具有合併帳單功能的組織，請在「簡介」頁面和 **Create an organization** (建立組織) 下，選擇 **consolidated billing features** (合併帳單功能)，然後在 Confirmation (確認) 對話方塊中，選擇 **Create an organization** (建立組織)。

   如果您不小心選擇了錯誤的選項，您可以立即前往 **[Settings](https://console.aws.amazon.com/organizations/v2/home/settings)** (設定) 頁面，然後選擇 **Delete organization** (刪除組織)，並重新開始

1. 組織會隨即建立，且 **[AWS 帳戶](https://console.aws.amazon.com/organizations/v2/home/accounts)** 頁面會隨即出現。唯一存在的帳戶是您的管理帳戶，並且其目前存放在[根組織單位 (OU)](orgs_getting-started_concepts.md#root)。

   如有必要，Organizations 會自動傳送驗證電子郵件至與您管理帳戶關聯的地址。在您收到驗證電子郵件之前，可能會有一些延遲的時間。請在 24 小時內驗證您的電子郵件地址。如需詳細資訊，請參閱[使用 的電子郵件地址驗證 AWS Organizations](about-email-verification.md)。您可以建立帳戶以發展您的組織，而不驗證您的管理帳戶的電子郵件地址。不過，若要邀請現有的帳戶，您必須先完成電子郵件驗證。
**注意**  
如果此帳戶之前已驗證其電子郵件地址，則在您使用該帳戶建立組織時，就不會再發生這種情況。

### AWS CLI & AWS SDKs
<a name="create-org-cli-sdk"></a>

下列程式碼範例示範如何使用 `CreateOrganization`。

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

**適用於 .NET 的 SDK**  
 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 an organization in AWS Organizations.
    /// </summary>
    public class CreateOrganization
    {
        /// <summary>
        /// Creates an Organizations client object and then uses it to create
        /// a new organization with the default user as the administrator, and
        /// then displays information about the new organization.
        /// </summary>
        public static async Task Main()
        {
            IAmazonOrganizations client = new AmazonOrganizationsClient();

            var response = await client.CreateOrganizationAsync(new CreateOrganizationRequest
            {
                FeatureSet = "ALL",
            });

            Organization newOrg = response.Organization;

            Console.WriteLine($"Organization: {newOrg.Id} Main Accoount: {newOrg.MasterAccountId}");
        }
    }
```
+  如需 API 詳細資訊，請參閱《適用於 .NET 的 AWS SDK API 參考》**中的 [CreateOrganization](https://docs.aws.amazon.com/goto/DotNetSDKV3/organizations-2016-11-28/CreateOrganization)。

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

**AWS CLI**  
**範例 1：建立新組織**  
Bill 想要使用帳戶 111111111111 的憑證來建立組織。下列範例顯示帳戶成為新組織中的主要帳戶。由於他未指定功能集，因此新組織會預設為啟用所有功能，並在根帳戶上啟用服務控制政策。  

```
aws organizations create-organization
```
輸出包含一個組織物件，其中包含新組織的詳細資訊：  

```
{
        "Organization": {
                "AvailablePolicyTypes": [
                        {
                                "Status": "ENABLED",
                                "Type": "SERVICE_CONTROL_POLICY"
                        }
                ],
                "MasterAccountId": "111111111111",
                "MasterAccountArn": "arn:aws:organizations::111111111111:account/o-exampleorgid/111111111111",
                "MasterAccountEmail": "bill@example.com",
                "FeatureSet": "ALL",
                "Id": "o-exampleorgid",
                "Arn": "arn:aws:organizations::111111111111:organization/o-exampleorgid"
        }
}
```
**範例 2：建立僅啟用合併帳單功能的新組織**  
下列範例會建立僅支援合併帳單功能的組織：  

```
aws organizations create-organization --feature-set CONSOLIDATED_BILLING
```
輸出包含一個組織物件，其中包含新組織的詳細資訊：  

```
{
        "Organization": {
                "Arn": "arn:aws:organizations::111111111111:organization/o-exampleorgid",
                "AvailablePolicyTypes": [],
                "Id": "o-exampleorgid",
                "MasterAccountArn": "arn:aws:organizations::111111111111:account/o-exampleorgid/111111111111",
                "MasterAccountEmail": "bill@example.com",
                "MasterAccountId": "111111111111",
                "FeatureSet": "CONSOLIDATED_BILLING"
        }
}
```
如需詳細資訊，請參閱《AWS Organizations 使用者指南》**中的建立組織。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [CreateOrganization](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/organizations/create-organization.html)。

------

建立組織之後，您可以透過這些方式從管理帳戶將帳戶新增至您的組織：
+ [建立會自動新增至組織作為成員帳戶的其他 AWS 帳戶](orgs_manage_accounts_create.md) 帳戶
+ [驗證您的電子郵件地址](about-email-verification.md)後，[邀請現有的 AWS 帳戶](orgs_manage_accounts_invite-account.md) 加入您的組織做為成員帳戶。