Delete all s3 buckets that contain string

function cleanup_buckets {
	local dry=true;
	for line in `aws s3 ls`;do
		if [[ "$line" =~ "wla" ]];then
			echo $line; 
			if [ "$dry" != "true" ];then
				aws s3 rm --recursive s3://$line
				aws s3 rb s3://$line
			fi
		fi
	done
}

Leave a Reply

Your email address will not be published.