Skip to content

Instantly share code, notes, and snippets.

@bobzoller
Created February 21, 2017 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobzoller/00d43004ca4a2403c1d34f1b4a9229e0 to your computer and use it in GitHub Desktop.
Save bobzoller/00d43004ca4a2403c1d34f1b4a9229e0 to your computer and use it in GitHub Desktop.
find tasks that aren't using AWS ECR
#!/bin/bash
set -e
set -o pipefail
#set -x
ACCOUNT=prod
arns=$(aws-vault exec "$ACCOUNT" -- aws ecs list-task-definitions | jq -r '.taskDefinitionArns | join("\n")')
families=$(echo "$arns" | awk -F '/' '{print $2}' | awk -F ':' '{print $1}' | sed '/^[[:space:]]*$/d' | sort | uniq)
for family in $families; do
images=$(aws-vault exec "$ACCOUNT" -- aws ecs describe-task-definition --task-definition "$family" | jq -r '.taskDefinition.containerDefinitions | map(.image) | join("\n")')
if echo "$images" | grep -qv 'dkr.ecr'; then
echo "FAIL $family"
else
echo "PASS $family"
fi
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment