Created
September 8, 2023 18:10
-
-
Save corkupine/5097ac428ab15ee506adb13cc647e4f7 to your computer and use it in GitHub Desktop.
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
# This doesn't work well with paging in CLI v2 - do this too: | |
# export AWS_PAGER="" | |
BUCKET_NAME=argocdexport | |
OBJECT_KEY=export.yaml | |
versions=$(aws s3api list-object-versions --bucket $BUCKET_NAME --prefix $OBJECT_KEY | jq -r '.Versions[].VersionId') | |
count=`echo $versions |jq 'length'`-1 | |
echo "Retrieved $count versions" | |
for version in $versions | |
do | |
echo "Deleting $version..." | |
aws s3api delete-object --bucket $BUCKET_NAME --key $OBJECT_KEY --version-id $version | |
echo "Deleted $version" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment