Hi Vladyslav,
It depends on how you look at it — yes it is expensive when you’re looking at 10s of thousands of devices, but when you break it down the cost per device for the API Gateway component is relatively small. Let me provide an example (and hope my maths is correct!).
If we have 10,000 devices set up to transmit once per minute each (which is extremely frequent for a LoRAWAN device), we’re looking at:
- 600,000 transmissions per hour
- 14,400,000 transmissions per day
- 432,000,000 transmissions per month
Let's say each response is also 1KB in size, so 432GB of data per month.
API Gateway: (432,000,000 / 1,000,000) * 3.50 = $1512
Data Transfer: 432 * 0.09 = $38.88
Total: $1550.88
If we divide that by our 10,000 devices, the API Gateway component is around $0.16 per device. Given most clients would be paying upwards of $10 per device per month, it’s a small percentage.
In terms of using the device Id as the partition key — the thought behind this was so when you have multiple shards in use, if you have sequential data going to multiple different shards for the same device, a less busy shard could be consumed from faster than a busy shard, which means your data is consumed out of order. By using the device Id as the partition key, in theory, data relating to a device should go via the same shard and then processed in order by the Kinesis consumers.
Hope this helps!