Skip to content

Instantly share code, notes, and snippets.

@alana314
Created March 12, 2022 01:29
Show Gist options
  • Save alana314/fbb8729531a3ebcd832bf30333fff6e5 to your computer and use it in GitHub Desktop.
Save alana314/fbb8729531a3ebcd832bf30333fff6e5 to your computer and use it in GitHub Desktop.
#!/bin/sh
#Sync and then nuke S3 Bucket and all contents
if [ $# != 1 ]; then
echo "Usage: $0 [S3-bucket-name]" >&2
exit 1
fi
echo "Sync $1 to local? Press [ENTER] to continue"
read -s < /dev/tty
aws s3 sync s3://$1 ./$1
echo "Empty bucket $1? Press [ENTER] to continue"
read -s < /dev/tty
aws s3 rm s3://$1 --recursive
echo "Delete bucket $1? Press [ENTER] to continue"
read -s < /dev/tty
aws s3 rb s3://$1
echo "ok"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment