I have read in a blog that I could "make" a dynamodb table multi tenant using the tenant id as the partition key and for e.g. the sort key as the customer id.
It's sounds good, but imagine that I have a big workload for a tenant id = X, so I am going to have big workload on the same partition.
Is it better to create a hash key that is the concatenate the tenantid + customerid, so i will not have a hotspot?
Yes, you can, depending on your access pattern.
Whenever you want to
GetorQueryitems from a DynamoDB table, you need to provide the exact partition-key. If you don't do that, you can onlyScan, which is a costly operation.If you'll mostly be interested in data at
tenant-id + customer-id>, then it makes sense to make it partition-key. If you won't havecustomer-id, then you should keeptenant-idas partition-key.