Skip to content
Pin EBS volumes to EC2 hosts - automatically snapshot and restore in different AZs
Python Other
  1. Python 98.8%
  2. Other 1.2%
Branch: master
Clone or download
Pull request Compare This branch is 17 commits ahead of discobean:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
e2e
ebspin
pip
.env
.gitignore
.gitlab-ci.yml
Makefile
README.md
docker-compose.yml
ebs-pin
requirements.txt
setup.py
test.py

README.md

ebs-pin

Pin EBS volumes to EC2 hosts.

pip install ebs-pin3

Previous versions for 2.7 are available as

pip install ebs-pin

Features

  • If EBS volume exists in same AZ as EC2 instance
    • Attaches it
  • If volume exists in another AZ, then
    • Creates a volume from snapshot and attaches it
  • Otherwise, it creates a new volume and attaches it

Also has a method to create snapshots you can place in cron, and is able to tag volumes

Usage

Attach a new or existing volume

ebs-pin attach -h # Help!
ebs-pin attach -u some-arbitrary-static-id -d /dev/xvdf -s 10 -t gp2 --tags Team=DevOps Application=UnDevOpsLikeHost

Snapshot the current attached volume

ebs-pin snapshot -h # Help!
ebs-pin snapshot -u some-arbitrary-static-id --tags SnappedTag=ChooseSomething

Thanks to

  • This is almost line for line copy of stapler code in Ruby
  • A shout out goes to Gonz who thought of it originally

Build notes

To build and upload

make upload

TODO

  • Check if already mounted before attempting to run again
  • Delete old snapshot once snapshot succeeds, keep X snapshots
You can’t perform that action at this time.