Amazon Keyspaces - Hands On Demo
Creating a Keyspace
-
Open Amazon Keyspaces Service: Navigate to the Amazon Keyspaces console after logging into the AWS Management Console.
-
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.
-
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
andactivity_date
as the primary key. - Set Default Settings.
- Click 'Create table'.
Inserting Data
-
Open Table: Navigate to
UserActivityTable
inUserActivityKeyspace
. -
Click "Query table".
-
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
-
Run Below Query.
-
Note down UUID
SELECT * FROM "UserActivityKeyspace"."UserActivityTable";
Update Data
-
Run Below Query.
-
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
-
Run Below Query.
-
Note down UUID
SELECT * FROM "UserActivityKeyspace"."UserActivityTable";
Delete Data
-
Run Below Query.
-
Replace UUID.
DELETE FROM "UserActivityKeyspace"."UserActivityTable"
WHERE user_id = 123e4567-e89b-12d3-a456-426614174000
AND activity_date = '2024-01-26';
Verify Data
-
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