Skip to content

Instantly share code, notes, and snippets.

@mizzy
Created August 20, 2024 01:59
Show Gist options
  • Save mizzy/3013964bb5fcdb6c9eee4345cb76c9e4 to your computer and use it in GitHub Desktop.
Save mizzy/3013964bb5fcdb6c9eee4345cb76c9e4 to your computer and use it in GitHub Desktop.
#!/bin/bash
state_machine_arns=$(aws stepfunctions list-state-machines | jq -r .stateMachines[].stateMachineArn)
for state_machine_arn in ${state_machine_arns}; do
echo "{ $(aws stepfunctions describe-state-machine --state-machine-arn ${state_machine_arn} \
| jq -r .definition \
| jq . \
| grep TaskDefinition) }" \
| jq -r .TaskDefinition
done
clusters=$(aws ecs list-clusters | jq -r .clusterArns[])
for cluster in ${clusters}; do
task_arns=$(aws ecs list-tasks --cluster ${cluster} | jq -r .taskArns[])
if [ -n "${task_arns}" ]; then
aws ecs describe-tasks --tasks ${task_arns} --cluster ${cluster} | jq -r .tasks[].taskDefinitionArn
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment