saas
SaaS Multi-Tenant
Organisations and their members in one table, isolated by partition.
A single-table design where every item for an organisation shares the partition key ORG#<orgId>. Members live beside the org record, so the whole tenant reads in one Query.
The model
Organisation
A tenant.
- pk
- ORG#<orgId>
- sk
- ORG#<orgId>
Attributes: orgId (S), name (S), plan (S)
Membership
A user's membership of an organisation, with a role.
- pk
- ORG#<orgId>
- sk
- MEMBER#<userId>
Attributes: orgId (S), userId (S), role (S)
Access patterns
- QueryGet organisation members
List every member of an organisation.
- GetItemGet an organisation
Fetch a single organisation record.
Design notes
Isolation by partition keywhy
Every item for a tenant shares ORG#<orgId>, so a tenant's data never leaks into another's reads and the whole tenant is one Query away.
Org record beside its memberstrade-off
Storing the organisation under SK = ORG#<orgId> keeps it in the same partition as its members, so one Query can fetch the org and its people together.
Taught in the course
- One query, a whole collection - Items that share a partition key are read together in one Query.
These rows are real and already here. Running an operation against them downloads a DynamoDB-compatible engine, about 850 KB, and executes it in this tab.
List every member of an organisation.
Run an operation to see the raw engine response.
Transactions, streams, tags and TTL are among the operations the in-browser engine doesn't implement yet.