liveBook · Manning

Universally unique identifier

As explained in Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

A UUID is a standardized 128-bit identifier designed to be unique across systems and generated without centralized coordination.

A universally unique identifier (UUID) is a randomly generated identifier used to distinguish records or objects without requiring centralized coordination. Identical UUIDs are unlikely, so a client can generate one before sending a request. section 16.2.2 section 7.1

UUIDs support distributed application designs in several ways:

  • Use a UUID as a database primary key when creating a record through a load-balanced backend. section 16.2.2
  • Use the same UUID on retries so the backend can detect an existing record instead of inserting a duplicate. section 16.2.2
  • Use a globally unique identifier as an object-store key for addressing data from different machines. section 7.1

Idempotent blog-post creation

A client generates 550e8400-e29b-11d4-a716-446655440000 and sends it with a blog post. The backend inserts the post only when that primary key is absent. If a retry arrives with the same UUID, the existing record means the operation has already succeeded. section 16.2.2

Figure 16.5 Idempotent database insert: Creating a blog post entry in the database only if it doesn’t already exist

Trace the insert-if-absent flow that uses a UUID to make database writes safe to retry. section 16.2.2

How Amazon Web Services in Action, Third Edition: An in-depth guide to AWS covers it

How deep it goes
Defines UUIDs and demonstrates insert-if-absent behavior, but does not explain generation algorithms or collision probabilities.
Examples
Uses an object-store key and a blog-post UUID, including the value 550e8400-e29b-11d4-a716-446655440000.
What it assumes
Assumes basic familiarity with clients, backend servers, databases, primary keys, and retries.
What you can do after
Apply UUIDs as client-generated primary keys to prevent duplicate database records during retries.
How it connects
Connects UUIDs with object storage, database primary keys, distributed systems, load balancing, and idempotence.

Also explained in

Compare how 10 books explain universally unique identifier →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Amazon Web Services in Action, Third Edition: An in-depth guide to AWS. The section links point to the parts of the book it draws on.