-
Notifications
You must be signed in to change notification settings - Fork 3
[CC-003] AWS Cost Explorer pagination may be incomplete #18
Copy link
Copy link
Open
Labels
Description
Description
AWS Cost Explorer API supports pagination via NextPageToken but the code may not properly handle pagination for very large result sets.
Location
- File:
cost_collect.py- AWS cost collection function
Impact
- Medium - Cost data may be truncated for accounts with many services/resources
- Incorrect cost totals for large AWS organizations
Suggested Fix
Ensure proper pagination loop:
results = []
next_token = None
while True:
params = {
'TimePeriod': {...},
'Granularity': 'MONTHLY',
'Metrics': ['UnblendedCost'],
'GroupBy': [...]
}
if next_token:
params['NextPageToken'] = next_token
response = ce_client.get_cost_and_usage(**params)
results.extend(response['ResultsByTime'])
next_token = response.get('NextPageToken')
if not next_token:
breakPriority
Medium
Source
cost_collect.py code review - CC-003
Reactions are currently unavailable