There are more AWS SDK examples available in the AWS Doc SDK Examples
Use DeleteOrganization with an AWS SDK or CLI
The following code examples show how to use DeleteOrganization.
- .NET
-
- SDK for .NET
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. using System; using System.Threading.Tasks; using Amazon.Organizations; using Amazon.Organizations.Model; /// <summary> /// Shows how to delete an existing organization using the AWS /// Organizations Service. /// </summary> public class DeleteOrganization { /// <summary> /// Initializes the Organizations client and then calls /// DeleteOrganizationAsync to delete the organization. /// </summary> public static async Task Main() { // Create the client object using the default account. IAmazonOrganizations client = new AmazonOrganizationsClient(); var response = await client.DeleteOrganizationAsync(new DeleteOrganizationRequest()); if (response.HttpStatusCode == System.Net.HttpStatusCode.OK) { Console.WriteLine("Successfully deleted organization."); } else { Console.WriteLine("Could not delete organization."); } } }-
For API details, see DeleteOrganization in AWS SDK for .NET API Reference.
-
- CLI
-
- AWS CLI
-
To delete an organization
The following
delete-organizationexample deletes an organization. To perform this operation, you must be an admin of the master account in the organization. The example assumes that you previously removed all the member accounts, OUs, and policies from the organization.aws organizations delete-organizationThis command produces no output.
For more information, see Deleting an organization with AWS Organizations in the AWS Organizations User Guide.
-
For API details, see DeleteOrganization
in AWS CLI Command Reference.
-