Count events for each customer_id as the input is read.
Keep only a counter per key even as the input grows.
Which implementation is most appropriate?
Use a Python dictionary or Counter keyed by customer_id to update each count in one pass.
Detailed explanation
Repeated scans grow costly as the number of events and keys increases.
Dictionary lookup and update provide an efficient one-pass key aggregation.
Object protection does not perform an in-memory aggregation.
An API operation name is not the business customer_id dimension.
Check official documentation
Compare the following points with the official documentation.
Python dictのget、setdefault、collections.Counterの公式ドキュメントを確認する。
What to confirm
辞書集計と全件線形検索、保存保護の違いを説明できる。
Key points
- Python dict
- Counter
- Key aggregation
- Complexity
Notes
- Environment: AWS公式DEA-C01試験ガイドと各サービスの公式ドキュメントの確認
- Confirm current AWS service behavior in the official DEA-C01 documentation.
Foundation review
One-pass aggregation
A dictionary or Counter avoids repeated full scans for each key.
Memory bound
High-cardinality keys may require partitioning or external state when counters grow large.