# Get number of running containers of a service aws --profile saml --output json ecs describe-services --cluster DIT-DMZ --service adp-e-bot-kafka | jq '.services[]|.desiredCount' # Get a list of all task definitions aws --profile saml --output text ecs list-task-definition-families # Get the JSONs of a task definition aws --profile saml --output json ecs describe-task-definition --task-def DIT-adp-e-bot | jq '.taskDefinition|if .networkMode then {family: .family, volumes: .volumes, containerDefinitions: .containerDefinitions, networkMode: .networkMode} else {family: .family, volumes: .volumes, containerDefinitions: .containerDefinitions} end' # Get all task definition and save each as a JSON while read a b; do aws --profile saml --output json ecs describe-task-definition --task-def $b | jq '.taskDefinition|if .networkMode then {family: .family, volumes: .volumes, containerDefinitions: .containerDefinitions, networkMode: .networkMode} else {family: .family, volumes: .volumes, containerDefinitions: .containerDefinitions} end' > $b.json ; done < <(aws --profile saml --output text ecs list-task-definition-families) # Delete all images without a tag from a given repo aws ecr batch-delete-image --repository-name myrepo --image-ids $(aws ecr list-images --repository-name myrepo --filter tagStatus=UNTAGGED --query 'imageIds[*]'| tr -d " \t\n\r")