Skip to content

Instantly share code, notes, and snippets.

@ecentinela
Forked from weirded/destroy_volume.sh
Created October 31, 2016 10:27
Show Gist options
  • Save ecentinela/563f6ba89125f363443fa163a090be08 to your computer and use it in GitHub Desktop.
Save ecentinela/563f6ba89125f363443fa163a090be08 to your computer and use it in GitHub Desktop.
Data Destroying Drone script
#!/bin/bash
set -e
export INSTANCE_ID=`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id`
export VOLUME_ID=v-12345678
export EC2_URL=https://ec2.us-east-1.amazonaws.com
export EC2_ACCESS_KEY=[key id]
export EC2_SECRET_KEY=[key]
sudo apt-get install scrub
euca-attach-volume -i $INSTANCE_ID -d /dev/sdj $VOLUME_ID
sudo scrub -b 50M -p dod /dev/sdj > ~/sdj.scrub.log 2>&1
sleep 30
euca-detach-volume $VOLUME_ID
euca-delete-volume $VOLUME_ID
halt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment