DynamoDB Item Insert Limit

0

Is there a way to limit the number of items inserted in a DynamoDB by user ID. I have an alexa skill that i want to limit the number of items added to table by the alexa user ID? Or is there a way to have DynamoDB table count the unique user ids and limit insert for each id after, for example, 5 entries? So, every unique user id can only have 5 entries.

llmcd
gefragt vor 2 Jahren623 Aufrufe
2 Antworten
1

For this you would need to keep a counter record for each item and use DynamoDB Transactions to achieve your use case. For each AlexaID create a record for storing counts of records:

PkSkItems
AlexaIdCounter3

Then you would use a TransactWrite with a condition for each new write, and also an Update to update the counter.

TransactWrite:
Put - new item
Update - update counter ++
Condition - if counter record Items value < 6
profile pictureAWS
EXPERTE
beantwortet vor 2 Jahren
0

There is not a way to have this enforced automatically. You'd have to keep a counter yourself and have your application code ensure requests were rejected that exceeded your limit.

AWS
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen