AWS SDK を使用して Organizations 組織を作成する - AWS SDK コードサンプル

Doc AWS SDK Examples リポジトリには、他にも SDK の例があります。 AWS GitHub

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

AWS SDK を使用して Organizations 組織を作成する

次のコード例は、組織の組織を作成する方法を示しています。

.NET
AWS SDK for .NET
注記

には他にもがあります GitHub。用例一覧を検索し、AWS コードサンプルリポジトリでの設定と実行の方法を確認してください。

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 の詳細については、「 API リファレンスCreateOrganization」の「」を参照してください。 AWS SDK for .NET

CLI
AWS CLI

例 1: 新しい組織を作成するには

Bill は、アカウント 111111111111 の認証情報を使用して組織を作成したいと考えています。次の例は、このアカウントが新しい組織のマスターアカウントになることを示しています。Bill は機能セットを指定していないため、新しい組織ではデフォルトですべての機能が有効になり、サービスコントロールポリシーがルート上で有効になります。

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 ユーザーガイド」の「Creating an Organization」を参照してください。

  • API の詳細については、「 コマンドリファレンスCreateOrganization」の「」を参照してください。 AWS CLI