Delete an instance

You can delete an instance programmatically when you use one of the Bigtable client libraries or manually using the Google Cloud console, the Google Cloud CLI, or the cbt CLI :

Console

  1. Open the list of Bigtable instances in the Google Cloud console.

    Open the instance list

  2. Click the instance you want to delete, then click Delete instance . A confirmation dialog appears.

    Screenshot of the Delete instance dialog

  3. Follow the instructions in the confirmation dialog, then click Delete . The instance is permanently deleted.

gcloud

  1. Install the Google Cloud CLI if you haven't already.
  2. If you don't know the instance ID, use the bigtable instances list command to view a list of your project's instances:

     gcloud bigtable instances list 
    
  3. Use the bigtable instances delete command to delete an instance:

     gcloud bigtable instances delete INSTANCE_ID 
     
    

    Replace INSTANCE_ID with the permanent identifier for your instance.

cbt

  1. Install the cbt CLI if you haven't already.
  2. If you don't know the instance ID, use the listinstances command to view a list of your project's instances:

     cbt listinstances 
    
  3. Use the deleteinstance command to delete an instance:

     cbt deleteinstance INSTANCE_ID 
     
    

    Replace INSTANCE_ID with the permanent identifier for your instance.

C++

To learn how to install and use the client library for Bigtable, see Bigtable client libraries .

To authenticate to Bigtable, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .

  namespace 
  
 cbt 
  
 = 
  
 :: 
 google 
 :: 
 cloud 
 :: 
 bigtable 
 ; 
 namespace 
  
 cbta 
  
 = 
  
 :: 
 google 
 :: 
 cloud 
 :: 
 bigtable_admin 
 ; 
 using 
  
 :: 
 google 
 :: 
 cloud 
 :: 
 Status 
 ; 
 []( 
 cbta 
 :: 
 BigtableInstanceAdminClient 
  
 instance_admin 
 , 
  
 std 
 :: 
 string 
  
 const 
&  
 project_id 
 , 
  
 std 
 :: 
 string 
  
 const 
&  
 instance_id 
 ) 
  
 { 
  
 std 
 :: 
 string 
  
 instance_name 
  
 = 
  
 cbt 
 :: 
 InstanceName 
 ( 
 project_id 
 , 
  
 instance_id 
 ); 
  
 Status 
  
 status 
  
 = 
  
 instance_admin 
 . 
 DeleteInstance 
 ( 
 instance_name 
 ); 
  
 if 
  
 ( 
 ! 
 status 
 . 
 ok 
 ()) 
  
 throw 
  
 std 
 :: 
 runtime_error 
 ( 
 status 
 . 
 message 
 ()); 
  
 std 
 :: 
 cout 
 << 
 "Successfully deleted the instance " 
 << 
 instance_id 
 << 
 " 
 \n 
 " 
 ; 
 } 
 

C#

To learn how to install and use the client library for Bigtable, see Bigtable client libraries .

To authenticate to Bigtable, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .

  // Deletes an instance from the project. 
 // Initialize request argument(s). 
 DeleteInstanceRequest 
  
 request 
  
 = 
  
 new 
  
 DeleteInstanceRequest 
 { 
  
 InstanceName 
  
 = 
  
 new 
  
 InstanceName 
 ( 
 projectId 
 , 
  
 instanceId 
 ) 
 }; 
 try 
 { 
  
 // Make request. 
  
 Console 
 . 
 WriteLine 
 ( 
 "Waiting for operation to complete..." 
 ); 
  
 bigtableInstanceAdminClient 
 . 
 DeleteInstance 
 ( 
 request 
 ); 
 } 
 catch 
  
 ( 
 Exception 
  
 ex 
 ) 
 { 
  
 Console 
 . 
 WriteLine 
 ( 
 $"Exception while deleting {instanceId} instance" 
 ); 
  
 Console 
 . 
 WriteLine 
 ( 
 ex 
 . 
 Message 
 ); 
 } 
 

Java

To learn how to install and use the client library for Bigtable, see Bigtable client libraries .

To authenticate to Bigtable, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .

  try 
  
 { 
  
 adminClient 
 . 
 deleteInstance 
 ( 
 instanceId 
 ); 
  
 System 
 . 
 out 
 . 
 println 
 ( 
 "Instance deleted: " 
  
 + 
  
 instanceId 
 ); 
 } 
  
 catch 
  
 ( 
 NotFoundException 
  
 e 
 ) 
  
 { 
  
 System 
 . 
 err 
 . 
 println 
 ( 
 "Failed to delete non-existent instance: " 
  
 + 
  
 e 
 . 
 getMessage 
 ()); 
 } 
 

Node.js

To learn how to install and use the client library for Bigtable, see Bigtable client libraries .

To authenticate to Bigtable, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .

  console 
 . 
 log 
 ( 
 'Deleting Instance' 
 ); 
 await 
  
 instance 
 . 
 delete 
 (); 
 console 
 . 
 log 
 ( 
 `Instance deleted: 
 ${ 
 instance 
 . 
 id 
 } 
 ` 
 ); 
 

PHP

To learn how to install and use the client library for Bigtable, see Bigtable client libraries .

To authenticate to Bigtable, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .

  use Google\ApiCore\ApiException; 
 use Google\Cloud\Bigtable\Admin\V2\Client\BigtableInstanceAdminClient; 
 use Google\Cloud\Bigtable\Admin\V2\DeleteInstanceRequest; 
 /** 
 * Delete a bigtable instance 
 * 
 * @param string $projectId The Google Cloud project ID 
 * @param string $instanceId The ID of the Bigtable instance to be deleted 
 */ 
 function delete_instance( 
 string $projectId, 
 string $instanceId 
 ): void { 
 $instanceAdminClient = new BigtableInstanceAdminClient(); 
 $instanceName = $instanceAdminClient->instanceName($projectId, $instanceId); 
 printf('Deleting Instance' . PHP_EOL); 
 try { 
 $deleteInstanceRequest = (new DeleteInstanceRequest()) 
 ->setName($instanceName); 
 $instanceAdminClient->deleteInstance($deleteInstanceRequest); 
 printf('Deleted Instance: %s.' . PHP_EOL, $instanceId); 
 } catch (ApiException $e) { 
 if ($e->getStatus() === 'NOT_FOUND') { 
 printf('Instance %s does not exists.' . PHP_EOL, $instanceId); 
 } else { 
 throw $e; 
 } 
 } 
 } 
 

Python

To learn how to install and use the client library for Bigtable, see Bigtable client libraries .

To authenticate to Bigtable, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .

  print 
 ( 
 " 
 \n 
 Deleting instance" 
 ) 
 if 
 not 
 instance 
 . 
 exists 
 (): 
 print 
 ( 
 "Instance 
 {} 
 does not exist." 
 . 
 format 
 ( 
 instance_id 
 )) 
 else 
 : 
 instance 
 . 
 delete 
 () 
 print 
 ( 
 "Deleted instance: 
 {} 
 " 
 . 
 format 
 ( 
 instance_id 
 )) 
 

Ruby

To learn how to install and use the client library for Bigtable, see Bigtable client libraries .

To authenticate to Bigtable, set up Application Default Credentials. For more information, see Set up authentication for a local development environment .

  instance 
 . 
 delete 
 
Create a Mobile Website
View Site in Mobile | Classic
Share by: