Skip to content

Instantly share code, notes, and snippets.

@pwmcintyre
Created September 23, 2022 02:43
Show Gist options
  • Save pwmcintyre/16107640db8408d1b167307688965b78 to your computer and use it in GitHub Desktop.
Save pwmcintyre/16107640db8408d1b167307688965b78 to your computer and use it in GitHub Desktop.
list all buckets and their lifecycle rules
#! /usr/bin/env bash
# to make this blubage easier to read ...
WHITE="97"
BOLDWHITE="\e[1;${WHITE}m"
ENDCOLOR="\e[0m"
# list buckets and loop
aws s3api list-buckets --query 'Buckets[].[Name]' --output text | while read bucket ; do
echo "${BOLDWHITE}${bucket}${ENDCOLOR}"
aws s3api get-bucket-lifecycle-configuration --bucket $bucket
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment