QA
Beginner LevelCloud Computing (AWS/GCP/Azure)

What is Amazon DynamoDB and how do Partition Keys and Sort Keys structure data?

❓ Interview Prompt: Explain DynamoDB fully-managed NoSQL key-value architecture, Partition Keys (PK), Sort Keys (SK), and single-digit millisecond latency.

Amazon DynamoDB is a fully-managed serverless NoSQL key-value and document database designed for single-digit millisecond performance at any scale.

Primary Key Structures:

1
Partition Key (PK) (Simple Primary Key):
•
Internal hash functions use the Partition Key to determine which physical database partition stores the item.
•
All items with the same PK are stored together on the same physical partition.
2
Composite Primary Key (Partition Key + Sort Key):
•
Uses a Partition Key (PK) for grouping and a Sort Key (SK) for range ordering.
•
Allows querying items within a partition using operators like 'begins_with()', 'between', '>', and '<'.

Code Implementation Example

typescript
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
import { DynamoDBDocumentClient, QueryCommand } from '@aws-sdk/lib-dynamodb';

const client = DynamoDBDocumentClient.from(new DynamoDBClient({}));

// Querying DynamoDB using Partition Key (PK) and Sort Key (SK) range condition
const result = await client.send(new QueryCommand({
  TableName: 'Orders',
  KeyConditionExpression: 'CustomerId = :cid AND OrderDate >= :date',
  ExpressionAttributeValues: {
    ':cid': 'CUST_1042',
    ':date': '2026-01-01'
  }
}));
💡Querying DynamoDB using Composite Primary Key (Partition Key + Sort Key).
🎯 Interview Key Takeaway

DynamoDB uses Partition Keys to hash data across physical partitions and Sort Keys to order items within partitions.

#DynamoDB#NoSQL#Partition Key#Sort Key#Beginner
Back to all Cloud Computing (AWS/GCP/Azure) Questions→

More Cloud Computing (AWS/GCP/Azure) Interview Questions

Beginner LevelCloud Computing (AWS/GCP/Azure)

How does Serverless Architecture (AWS Lambda / GCP Cloud Run) handle Auto-Scaling and Cold Starts?

Beginner LevelCloud Computing (AWS/GCP/Azure)

What is the difference between IaaS, PaaS, and SaaS cloud service models?

Beginner LevelCloud Computing (AWS/GCP/Azure)

What is AWS EC2 and what are On-Demand, Reserved, and Spot Instance pricing models?