Tutorial Step 3: Delete a table and keyspace in Amazon Keyspaces - Amazon Keyspaces (for Apache Cassandra)

Tutorial Step 3: Delete a table and keyspace in Amazon Keyspaces

To avoid being charged for tables and data that you don't need, delete all the tables and keyspaces that you're not using. When you delete a table, the table and its data are deleted and you stop accruing charges for them. However, the keyspace remains. When you delete a keyspace, the keyspace and all its tables are deleted and you stop accruing charges for them.

Deleting a table

You can delete a table using the console or CQL. When you delete a table, the table and all its data are deleted.

The following procedure deletes a table and all its data using the AWS Management Console.

To delete a table using the console

  1. Sign in to the AWS Management Console, and open the Amazon Keyspaces console at https://console.aws.amazon.com/keyspaces/home.

  2. In the navigation pane, choose Tables.

  3. Choose the box to the left of the name of each table that you want to delete.

  4. Choose Delete.

  5. On the Delete table screen, enter Delete in the box. Then, choose Delete table.

  6. To verify that the table was deleted, choose Tables in the navigation pane, and confirm that the employees_tbl table is no longer listed.

The following procedure deletes a table and all its data using CQL.

To delete a table using CQL

  1. Open a command shell and enter the following:

    cqlsh

  2. Delete your table by entering the following command at the keyspace prompt (cqlsh:keyspace_name>).

    DROP TABLE IF EXISTS "myGSGKeyspace".employees_tbl ;
  3. Verify that your table was deleted.

    SELECT * FROM system_schema.tables WHERE keyspace_name = 'myGSGKeyspace' ;

    Your table should not be listed.

Deleting a keyspace

You can delete a keyspace using either the AWS Management Console or CQL. When you delete a keyspace, the keyspace and all its tables and data are deleted.

The following procedure deletes a keyspace and all its tables and data using the AWS Management Console.

To delete a keyspace using the console

  1. Sign in to the AWS Management Console, and open the Amazon Keyspaces console at https://console.aws.amazon.com/keyspaces/home.

  2. In the navigation pane, choose Keyspaces.

  3. Choose the box to the left of the name of each keyspace that you want to delete.

  4. Choose Delete.

  5. On the Delete keyspace screen, enter Delete in the box. Then, choose Delete keyspace.

  6. To verify that the keyspace myGSGKeyspace was deleted, choose Keyspaces in the navigation pane and confirm that it is no longer listed. Because you deleted its keyspace, the employees_tbl table under Tables should also not be listed.

The following procedure deletes a keyspace and all its tables and data using CQL.

To delete a keyspace using CQL

  1. Open a command shell and enter the following:

    cqlsh

  2. Delete your keyspace by entering the following command at the keyspace prompt (cqlsh:keyspace_name>).

    DROP KEYSPACE IF EXISTS "myGSGKeyspace" ;
  3. Verify that your keyspace was deleted.

    SELECT * from system_schema.keyspaces ;

    Your keyspace should not be listed.