Public Repository

Last pushed: a year ago
Short Description
Backup etcd
Full Description


Etcdbk is a tool for backing up the values in a live etcd cluster.

Etcdbk generates a tarball (tar.gz) with paths matching the keys in your etcd cluster. Etcdbk uses the etcd API instead of direct access to the etcd data directory, thus allowing backups to be generated on machines remote to the target cluster, or from within application containers.

Caveat: Because etcdbk only adds keys to resulting artifact, etcd paths that have no keys will be lost.


$ go get

Alternatively, a docker image is available at christianbladescb/etcdbk, or can be built via the script in the root of this repository.


  etcdbk [OPTIONS]

Application Options:
  -e, --etcd-hosts=   etcd machines ( [$ETCD_HOSTS]
  -o, --outfile=      Where to write the resulting tarball. '-' for STDOUT
  -n, --cluster-name= Cluster name to use in naming the file in the S3 Bucket
                      (etcd-cluster) [$CLUSTER_NAME]
      --aws-access=   Access key of an IAM user with write access to the given
                      bucket [$AWS_ACCESS_KEY_ID]
      --aws-secret=   Secret key of an IAM user with write access to the given
                      bucket [$AWS_SECRET_ACCESS_KEY]
      --s3-endpoint=  AWS S3 endpoint. See
                      ( [$AWS_S3_ENDPOINT]
      --aws-bucket=   Bucket in which to place the archive. [$AWS_S3_BUCKET]
      --debug         verbose logging

Help Options:
  -h, --help          Show this help message

Simple Example

To backup the keys from a cluster with a node running on localhost:

$ etcdbk -o ./my-etcd-backup.tar.gz

The archive at ./my-etcd-backup.tar.gz will contain a file system corresponding to the keys available in the etcd cluster.

Backing up to S3

Assuming you have previously created an S3 bucket and an IAM user with write access to that bucket:

$ etcdbk --cluster-name=my-etcd-cluster --aws-access=ACCESSKEY --aws-secret=SECRETKEYSAREALWAYSLONGER --s3-endpoint= --aws-bucket=etcdbackups

An archive will be saved into the specified bucket. The archive name will be in the format #{cluster name}-#{time in RFC3339}.tar.gz.


Docker Pull Command