Amazon Keyspaces - Hands On Demo

Creating a Keyspace

 

 

  1. Open Amazon Keyspaces Service: Navigate to the Amazon Keyspaces console after logging into the AWS Management Console.

  2. Create Keyspace:

    • Click on 'Create keyspace'.
    • Enter UserActivityKeyspace as the name.
    • Choose replication strategy as Single-Region replication.
    • Click 'Create keyspace'.

Creating a Table

 

Open Keyspace: Locate UserActivityKeyspace in the Amazon Keyspaces console.

  1. Create Table:

    • Click on 'Create table' within the keyspace.
    • Name the table UserActivityTable.
    • Add columns: user_id (UUID), activity_date (DATE), activity_type (TEXT), activity_description (TEXT).
    • Set user_id and activity_date as the primary key.
    • Set Default Settings.
    • Click 'Create table'.

Inserting Data

 

 

  1. Open Table: Navigate to UserActivityTable in UserActivityKeyspace.

  2. Click "Query table".

  3. Run Below Query

INSERT INTO "UserActivityKeyspace"."UserActivityTable" 
(user_id, activity_date, activity_type, activity_description) 
VALUES 
(uuid(), '2024-01-26', 'login', 'User logged in');

Query Data

 

 

  1. Run Below Query.

  2. Note down UUID

SELECT * FROM "UserActivityKeyspace"."UserActivityTable";

Update Data

 

 

  1. Run Below Query.

  2. Replace UUID.

UPDATE "UserActivityKeyspace"."UserActivityTable"
SET activity_description = 'User logged out'
WHERE user_id = 123e4567-e89b-12d3-a456-426614174000
  AND activity_date = '2024-01-26';

Verify Data

 

 

  1. Run Below Query.

  2. Note down UUID

SELECT * FROM "UserActivityKeyspace"."UserActivityTable";

Delete Data

 

 

  1. Run Below Query.

  2. Replace UUID.

DELETE FROM "UserActivityKeyspace"."UserActivityTable"
WHERE user_id = 123e4567-e89b-12d3-a456-426614174000
  AND activity_date = '2024-01-26';

Verify Data

 

 

  1. Run Below Query.

SELECT * FROM "UserActivityKeyspace"."UserActivityTable";

Thanks

For

Watching

Amazon Keyspaces - Hands On Demo

By Deepak Dubey

Amazon Keyspaces - Hands On Demo

Amazon Keyspaces - Hands On Demo

  • 49