Use DeleteIdentityPool with an Amazon SDK or CLI - Amazon Cognito
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use DeleteIdentityPool with an Amazon SDK or CLI

The following code examples show how to use DeleteIdentityPool.

CLI
Amazon CLI

To delete identity pool

The following delete-identity-pool example deletes the specified identity pool.

Command:

aws cognito-identity delete-identity-pool \ --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111"

This command produces no output.

Java
SDK for Java 2.x
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.cognitoidentity.CognitoIdentityClient; import software.amazon.awssdk.services.cognitoidentity.model.DeleteIdentityPoolRequest; /** * Before running this Java V2 code example, set up your development * environment, including your credentials. * * For more information, see the following documentation topic: * * https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/get-started.html */ public class DeleteIdentityPool { public static void main(String[] args) { final String usage = """ Usage: <identityPoolId>\s Where: identityPoolId - The Id value of your identity pool. """; if (args.length != 1) { System.out.println(usage); System.exit(1); } String identityPoold = args[0]; CognitoIdentityClient cognitoIdClient = CognitoIdentityClient.builder() .region(Region.US_EAST_1) .credentialsProvider(ProfileCredentialsProvider.create()) .build(); deleteIdPool(cognitoIdClient, identityPoold); cognitoIdClient.close(); } public static void deleteIdPool(CognitoIdentityClient cognitoIdClient, String identityPoold) { try { DeleteIdentityPoolRequest identityPoolRequest = DeleteIdentityPoolRequest.builder() .identityPoolId(identityPoold) .build(); cognitoIdClient.deleteIdentityPool(identityPoolRequest); System.out.println("Done"); } catch (AwsServiceException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } } }
PowerShell
Tools for PowerShell

Example 1: Deletes a specific Identity Pool.

Remove-CGIIdentityPool -IdentityPoolId us-east-1:0de2af35-2988-4d0b-b22d-EXAMPLEGUID1
  • For API details, see DeleteIdentityPool in Amazon Tools for PowerShell Cmdlet Reference.

Swift
SDK for Swift
Note

This is prerelease documentation for an SDK in preview release. It is subject to change.

Note

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

Delete the specified identity pool.

/// Delete the specified identity pool. /// /// - Parameters: /// - id: The ID of the identity pool to delete. /// func deleteIdentityPool(id: String) async throws { let input = DeleteIdentityPoolInput( identityPoolId: id ) _ = try await cognitoIdentityClient.deleteIdentityPool(input: input) }

For a complete list of Amazon SDK developer guides and code examples, see Using this service with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.