Why does AWS have their own UUID version?

Viewed 366

I've been working on an application hosted on the AWS cloud that is part of a data pipeline. The application processes events from EventBridge, does some data mapping and then puts the result on a Kinesis stream.

The incoming events payload looks something like this (truncated for readability):

{
  "version": "0",
  "id": "9a0f9e20-c518-a968-7fa6-1d8038a5bcfc",
  "detail-type": "Some sort of event",
  ....
}

and the event put onto the Kinesis stream looks something like:

{
    "eventId": "9a0f9e20-c518-a968-7fa6-1d8038a5bcfc",
    "eventTime": "2021-04-08T06:19:47.683Z",
    "eventType": "created",
    ...
}

I looked at the "id" attribute on the incoming event and at first glance it looks like a UUID. I put a few examples into an online validator and it came back as a valid UUID. Since it is a UUID and is supposed to be "universally unique" I thought I might just reuse that ID for the "eventId" attribute of the outgoing payload. I thought that might even make it easier to trace events back to the source.

However, when I started my integration testing I started to notice alarms going off on unrelated services. There were validation errors happening all over the place. Turns out that the downstream services didn't like the format of "eventId".

The downstream services use the "uuid" NPM module to validate UUIDs in our event envelopes and it seems like it doesn't like the UUIDs that come from AWS. To make sure that I had diagnosed the problem correctly I fired up a node REPL and tried to validate one of the UUIDs that came through and sure enough it came back as invalid!

> const uuid = require('uuid');
> u.validate("9a0f9e20-c518-a968-7fa6-1d8038a5bcfc")
false

I then checked the regex that the 'uuid' module was using to do the validation and I noticed that it was checking for the numbers 1-5 in the first character of the third group of the UUID.

Confused, I checked out the Wikipedia page for UUIDs and discovered that the UUID version of the UUIDs coming from AWS is A, instead of the expected version numbers (1-5)

I have a few related questions:

  1. Why does AWS have it's own UUID version?
  2. Is it even a UUID?
  3. Why would AWS go and violate the principle of least astonishment like that, surely it's easier to just use a regular UUID?

I'm hoping someone has an interesting story about how AWS had to invent their own UUID version to deal with some epic engineering problem that only happens at their scale, but I suppose I'll settle for a more simple answer.

0 Answers
Related