Skip to content

Instantly share code, notes, and snippets.

@kthallam
Last active September 26, 2019 13:33
Show Gist options
  • Save kthallam/79e23d68062eea98a1388c51140f590e to your computer and use it in GitHub Desktop.
Save kthallam/79e23d68062eea98a1388c51140f590e to your computer and use it in GitHub Desktop.
Script to find the elastic cache services that are not tagged with the specific tag in aws
#!/bin/bash
declare -a test
test=(`aws elasticache describe-cache-clusters | grep CacheClusterId | awk -F '"' '{print $4}'`)
i=0
while [ $i -lt ${#test[@]} ]
do
a=`aws elasticache list-tags-for-resource --resource-name arn:aws:elasticache:<Region>:<Account ID>:cluster:${test[$i]}| grep -w <KEY/Value of Tag >`
if [ -z "$a" ]
then
echo "${test[$i]} does not have tag "
fi
i=`expr $i + 1`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment