https://github.com/discobean/ebs-pin
Pin EBS volumes to EC2 hosts - automatically snapshot and restore in different AZs
https://github.com/discobean/ebs-pin
aws ebs ec2 pinning
Last synced: about 2 months ago
JSON representation
Pin EBS volumes to EC2 hosts - automatically snapshot and restore in different AZs
- Host: GitHub
- URL: https://github.com/discobean/ebs-pin
- Owner: discobean
- Created: 2017-02-13T11:37:48.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-10-21T15:09:49.000Z (over 6 years ago)
- Last Synced: 2025-12-17T03:21:13.656Z (6 months ago)
- Topics: aws, ebs, ec2, pinning
- Language: Python
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://github.com/mikelorant/stapler.git) code in Ruby
* A shout out goes to [Gonz](https://github.com/gservat) 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