Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
AWS CLI delete all tags in a bucket
# Make sure you have aws installed:
# Make sure you have jq installed:
aws s3api list-objects --bucket $BUCKET --prefix $PREFIX --profile $PROFILE \ # List objects in bucket and prefix
| jq ".Contents" \ # Get the array of ojbects
| jq "map(\"aws s3api delete-object-tagging --profile ${PROFILE} --bucket ${BUCKET} --key \" + .Key)" \ # Create a delete-object-tagging command for each object
| jq -r '.[]' \ # Output one command per line
| sh # Pass the commands into shell to be run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment