D’autres exemples de kits AWS SDK sont disponibles dans le référentiel GitHub AWS Doc SDK Examples
Utilisation de CreateOrganization avec un kit AWS SDK ou une interface de ligne de commande
Les exemples de code suivants illustrent comment utiliser CreateOrganization.
- .NET
-
- SDK pour .NET
-
Note
Il y en a plus sur GitHub. Trouvez l’exemple complet et découvrez comment le configurer et l’exécuter dans le référentiel d’exemples de code 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}"); } }-
Pour plus de détails sur l’API, consultez CreateOrganization dans la Référence des API du kit AWS SDK pour .NET.
-
- CLI
-
- AWS CLI
-
Exemple 1 : pour créer une organisation
Bill souhaite créer une organisation à l’aide des informations d’identification du compte 111111111111. L’exemple suivant montre que le compte devient le compte principal de la nouvelle organisation. Comme il ne spécifie aucun ensemble de fonctionnalités, la nouvelle organisation utilise par défaut toutes les fonctionnalités activées et les politiques de contrôle des services sont activées à la racine.
aws organizations create-organizationLa sortie inclut un objet d’organisation contenant des détails sur la nouvelle organisation :
{ "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" } }Exemple 2 : pour créer une organisation avec uniquement les fonctionnalités de facturation consolidée activées
L’exemple suivant crée une organisation qui prend uniquement en charge les fonctionnalités de facturation consolidée :
aws organizations create-organization --feature-setCONSOLIDATED_BILLINGLa sortie inclut un objet d’organisation contenant des détails sur la nouvelle organisation :
{ "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" } }Pour plus d’informations, consultez Création d’une organisation dans le Guide de l’utilisateur AWS Organizations.
-
Pour plus de détails sur l’API, consultez CreateOrganization
dans la Référence des commandes de l’AWS CLI.
-