Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ebroder/ebuse
Access an EBS snapshot directly through NBD
https://github.com/ebroder/ebuse
aws ebs ebs-snapshots network-block-device
Last synced: 12 days ago
JSON representation
Access an EBS snapshot directly through NBD
- Host: GitHub
- URL: https://github.com/ebroder/ebuse
- Owner: ebroder
- License: mit
- Created: 2020-10-02T00:35:52.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-12-02T02:25:32.000Z (about 2 months ago)
- Last Synced: 2025-01-05T02:03:45.215Z (13 days ago)
- Topics: aws, ebs, ebs-snapshots, network-block-device
- Language: Go
- Homepage:
- Size: 27.3 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ebuse
ebuse is an [NBD][] server which uses the new EBS direct APIs to expose an EBS
snapshot as a network-accessible block device. You can use this to access data
in an EBS snapshot without needing to first restore it to an EBS volume.This implementation is definitely a bit of a toy, so I probably wouldn't use it
for production workloads. There aren't any tests, it's not particularly hardened
against error conditions, and it doesn't try to be particularly efficient in
data that it fetches. I also can't promise that it will be particularly well
maintained.Also, keep in mind that the EBS direct APIs aren't entirely free, although they
are quite cheap. Assume that you'll spend about 0.6c for every gigabyte you
read.Why "ebuse"? Originally I planned to build this using [BUSE][] (well, a Go
version of BUSE). "ebuse" is what you get when you smash "EBS" and "BUSE"
together. It also seemed appropriate that it sounded abusive - this is probably
not exactly what these APIs are intended for.## Usage
You can install ebuse by running
```
$ go get -u github.com/ebroder/ebuse
```ebuse only has one required argument - the snapshot ID you want it to serve. It
optionally accepts as flags the AWS region of that snapshot (although that can
also be passed in via the `AWS_REGION` environment variable) and the UNIX socket
path to bind the NBD server to (which defaults to somewhere reasonable in
`XDG_RUNTIME_DIR`):```
usage: ebuse [flags] snap-12345678
-region string
AWS region of snapshot (default "us-east-1")
-socket string
path to listen on (default "/run/user/1000/nbd.sock")
```ebuse depends on having access to AWS credentials from the environment. It
supports everything that the AWS SDK supports [out of the box][AWS credentials].Once you've started the ebuse NBD server, you can connect to it using something
like `nbd-client`:```
$ sudo nbd-client -unix $XDG_RUNTIME_DIR/nbd.sock
Warning: the oldstyle protocol is no longer supported.
This method now uses the newstyle protocol with a default export
Negotiation: ..size = 8192MB
Connected /dev/nbd1
```...and voila! You now have a block device (`/dev/nbd1` in this case) backed by
an EBS snapshot. Note that if you want to mount the block device, you'll need to
pass `-o ro` to `mount`; otherwise it will try and fail to update the
superblock. For journaled filesystems, you may also want `-o noload`. And if
your EBS volume has a partition table, you should automatically get
partition-specific block devices (e.g. `/dev/nbd1p1`) - you'll need to mount
those instead.To disconnect, run
```
sudo nbd-client -d /dev/nbd1
```[NBD]: https://en.wikipedia.org/wiki/Network_block_device
[BUSE]: https://github.com/acozzette/BUSE
[AWS credentials]: https://docs.aws.amazon.com/sdk-for-go/api/#hdr-Configuring_Credentials