Amazon DynamoDB Tutorial 0/30 lessons ~6 min read Lesson 1

    Amazon DynamoDB Course Home

    This course takes you from your first DynamoDB table to production-grade designs used by high-traffic serverless systems.

    Course progress0%
    Focus
    11 guided sections
    Practice signal
    Examples included
    Career prep
    Interview Q&A included

    Introduction

    This course takes you from your first DynamoDB table to production-grade designs used by high-traffic serverless systems. You will model a real e-commerce workload — customers, orders, order lines, and products — in a single table, query it efficiently with secondary indexes, react to changes with Streams and Lambda, and protect it with transactions, IAM, and backups.

    DynamoDB rewards a different way of thinking than relational databases: you design around access patterns first, then choose keys that make each pattern a single, cheap request. Every module builds on the same ShopTable so the design decisions accumulate the way they do on a real team.

    Purpose of this lesson

    Use this page to understand the roadmap, set up a local environment, and decide where to start. Each lesson ends with a hands-on task and interview questions so you can check your understanding before moving on.

    Understanding the topic

    The six modules:

    • Module 1 · Foundations & Partition Keys — tables, items, keys, partitions, CRUD, and choosing partition keys that spread load.
    • Module 2 · Single-Table Design & Access Patterns — access-pattern-first modeling, item collections, one-to-many and many-to-many relationships, time series.
    • Module 3 · GSI/LSI & Query Optimization — capacity and consistency, Query vs Scan, global and local secondary indexes, sparse indexes, pagination.
    • Module 4 · DynamoDB Streams & Lambda Triggers — change data capture, stream processing with Lambda, TTL expiry events, outbox-style integration.
    • Module 5 · Transactions & Global Tables — conditional writes, optimistic locking, ACID transactions, batch operations, multi-Region replication.
    • Module 6 · Security, Backup & Interview Prep — IAM fine-grained access, encryption, PITR and restores, monitoring, cost, and interview practice.

    Step-by-step explanation

    1. Read Module 1 in order — partition keys drive every later decision.
    2. Write down the access patterns for your own app before Module 2; you will model them as you go.
    3. Keep DynamoDB Local running and paste each lesson's code into a scratch project.
    4. Finish each lesson's hands-on task before reading the interview questions.
    5. Use Module 6's interview lesson as a final review across the whole course.

    Syntax reference

    Local setup. Run DynamoDB Local in Docker and point the AWS CLI at it, so you can practise without an AWS bill:

    bash
    # Start DynamoDB Local (in-memory, port 8000)
    docker run --rm -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -inMemory -sharedDb
    # Dummy credentials are fine for DynamoDB Local
    export AWS_ACCESS_KEY_ID=local AWS_SECRET_ACCESS_KEY=local AWS_REGION=us-east-1
    # Create the course table
    aws dynamodb create-table \
    --endpoint-url http://localhost:8000 \
    --table-name ShopTable \
    --attribute-definitions AttributeName=PK,AttributeType=S AttributeName=SK,AttributeType=S \
    --key-schema AttributeName=PK,KeyType=HASH AttributeName=SK,KeyType=RANGE \
    --billing-mode PAY_PER_REQUEST
    aws dynamodb list-tables --endpoint-url http://localhost:8000

    Output

    {
        "TableNames": [
            "ShopTable"
        ]
    }

    Informative example

    The SDK client used throughout the course (AWS SDK for JavaScript v3 with the Document client, which converts plain JavaScript values to DynamoDB types):

    ts
    // npm install @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb
    import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
    import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
    const client = new DynamoDBClient({
    region: "us-east-1",
    // Remove endpoint to talk to real AWS.
    endpoint: process.env.DYNAMODB_ENDPOINT ?? "http://localhost:8000",
    });
    export const ddb = DynamoDBDocumentClient.from(client, {
    marshallOptions: { removeUndefinedValues: true },
    });
    export const TABLE = "ShopTable";

    Best practices

    • Practise on DynamoDB Local or a sandbox AWS account with on-demand billing and a budget alarm.
    • Keep a written access-pattern list next to every table you design.
    • Use the Document client so code works with plain JavaScript objects instead of attribute-value maps.

    Common mistakes

    • Designing tables like relational schemas (one table per entity, joins in application code).
    • Skipping partition-key design because a small dataset seems fast — problems appear only at scale.

    Advanced interview questions

    Interview Prep

    Practice concise answers, then expand each card for the explanation.

    2 questions
    1BeginnerQuestionWhen is DynamoDB a good fit, and when is it not?+

    Answer

    It fits workloads with well-known access patterns that need predictable low latency at any scale — carts, sessions, orders, IoT telemetry, user profiles. It is a poor fit for ad-hoc analytics, frequently changing query shapes, or heavy multi-entity reporting, where a relational database or a warehouse is simpler.
    2IntermediateQuestionWhy does DynamoDB modeling start with access patterns?+

    Answer

    DynamoDB has no joins and only efficient key-based queries. If the keys do not match how the app reads data, you end up with Scans or many round trips. Listing access patterns first lets you choose partition and sort keys (and indexes) so each pattern is one Query or GetItem.

    Hands-on exercise

    Set up your lab: start DynamoDB Local, create ShopTable with the command above, and run aws dynamodb describe-table --table-name ShopTable --endpoint-url http://localhost:8000. Confirm that KeySchema lists PK as HASH and SK as RANGE.

    Summary

    The course follows one e-commerce table through six modules: foundations, single-table design, indexes, streams, transactions and global tables, and production operations.

    Ready to mark this lesson complete?Track your journey across the entire course.