Skip to content

Conversation

vertti
Copy link
Owner

@vertti vertti commented Oct 6, 2025

Problem

Clusters with more than 10 services were crashing with the error:
Error: An error occurred (InvalidParameterException) when calling the DescribeServices operation: service names can have at most 10 items.

AWS ECS describe_services API has a hard limit of 10 services per call, but the code was attempting to describe all services in a single request.

Solution

Implemented batching for describe_services calls to process services in groups of 10:

  1. Added batch_items() utility function (src/lazy_ecs/core/utils.py)

    • Generic helper to split lists into fixed-size chunks
    • Reusable for other AWS API limits
  2. Updated ServiceService.get_service_info() (src/lazy_ecs/features/service/service.py)

    • Batches service names into groups of 10
    • Makes multiple describe_services calls as needed
    • Aggregates results from all batches
    • Uses Pythonic nested list comprehension for clean implementation
  3. Added comprehensive tests

    • test_batch_items_*: Tests for utility function with various edge cases
    • test_get_service_info_with_more_than_10_services: Verifies batching works correctly with 15 services
    • All existing tests continue to pass

Closes #37

vertti added 4 commits October 6, 2025 09:37
  AWS ECS describe_services API has a limit of 10 services per call.
  Updated get_service_info() to batch service names into groups of 10
  to avoid InvalidParameterException when clusters have more than 10 services.
@vertti vertti merged commit 6751dc8 into main Oct 6, 2025
3 checks passed
@vertti vertti deleted the fix-10-service-limit branch October 6, 2025 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to list ECS services when a cluster has more than 10 services

1 participant