Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Use DeleteIdentityPool with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DeleteIdentityPool with an AWS SDK or CLI

The following code examples show how to use DeleteIdentityPool.

CLI
AWS 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 AWS 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
Swift
SDK for Swift
Note

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

import AWSCognitoIdentity /// Delete the specified identity pool. /// /// - Parameters: /// - id: The ID of the identity pool to delete. /// func deleteIdentityPool(id: String) async throws { do { let input = DeleteIdentityPoolInput( identityPoolId: id ) _ = try await cognitoIdentityClient.deleteIdentityPool(input: input) } catch { print("ERROR: deleteIdentityPool:", dump(error)) throw error } }
AWS 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.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.