Skip to content

Instantly share code, notes, and snippets.

@xcsrz
Created October 15, 2025 23:32
Show Gist options
  • Save xcsrz/d3e11f27b705b80c4a3f33d403f677dd to your computer and use it in GitHub Desktop.
Save xcsrz/d3e11f27b705b80c4a3f33d403f677dd to your computer and use it in GitHub Desktop.
A simple python script to check all the services running on a fargate cluster to see if any are need to be upgraded before the March 2026 deadline: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform-version-migration.html
import boto3
import sys
ecs_client = boto3.client('ecs')
def chunker(seq, size):
for pos in range(0, len(seq), size):
yield seq[pos:pos + size]
def main():
if len(sys.argv) != 2:
print("Usage: python script.py <cluster_name>")
sys.exit(1)
cluster_name = sys.argv[1]
paginator = ecs_client.get_paginator('list_services')
service_arns = []
# Paginate through all services in the cluster
for page in paginator.paginate(cluster=cluster_name):
service_arns.extend(page['serviceArns'])
total_mismatched = 0
for service_arn in service_arns:
service_name = service_arn.split('/')[-1]
# List running tasks for the service
task_arns = ecs_client.list_tasks(cluster=cluster_name, serviceName=service_name, desiredStatus='RUNNING')['taskArns']
if not task_arns:
print(f"{service_name}: No running tasks")
continue
mismatched_count = 0
for task_chunk in chunker(task_arns, 100):
response = ecs_client.describe_tasks(cluster=cluster_name, tasks=task_chunk)
for task in response['tasks']:
if task['platformVersion'] != '1.4.0':
mismatched_count += 1
print(f"{service_name}: {mismatched_count} task(s) running with platform version != 1.4.0")
total_mismatched += mismatched_count
print(f"Total tasks running with non-1.4.0 platform version: {total_mismatched}")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment