Created
May 20, 2022 11:02
-
-
Save johndstein/a882f26b948b5d830282ce050ccb2836 to your computer and use it in GitHub Desktop.
find empty s3 buckets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# list empty buckets | |
buckets=$(aws s3api list-buckets| jq --raw-output '.Buckets[].Name') | |
for bucket in $buckets;do | |
files=$(aws s3 ls $bucket) | |
if [[ -z "$myVar" ]]; then | |
echo "$bucket" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment