Skip to content

Instantly share code, notes, and snippets.

@johndstein
Created May 20, 2022 11:02
Show Gist options
  • Save johndstein/a882f26b948b5d830282ce050ccb2836 to your computer and use it in GitHub Desktop.
Save johndstein/a882f26b948b5d830282ce050ccb2836 to your computer and use it in GitHub Desktop.
find empty s3 buckets
#!/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