Skip to content

Instantly share code, notes, and snippets.

@hatchcanon
Last active June 16, 2021 21:03
Show Gist options
  • Save hatchcanon/698dcba8b9854b5a2a754c0e5ebbc4e8 to your computer and use it in GitHub Desktop.
Save hatchcanon/698dcba8b9854b5a2a754c0e5ebbc4e8 to your computer and use it in GitHub Desktop.
list encryption status of all S3 buckets
for bucket_name in $(aws s3api list-buckets --query "Buckets[].Name" --output text); do
echo -ne "${bucket_name},"
encryption_info=$(aws s3api get-bucket-encryption \
--bucket ${bucket_name} 2>/dev/null)
if [[ $? != 0 ]]; then
echo "no-encryption"
else
echo "${encryption_info}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment