pgdump-to-s3-go create pg_dump, put dump file in the specified s3 URL.
Also change the file name and put it in s3 URL where all the past dump files are stored (ex: <backet_name>/<prefix_name>s/<file_name>.YYYYMMDD_HHMMSS
)
pg_dump
command- You need to set AWS credentials beforehand, or you can also use named profile written in
~/.aws/credentials
.
export AWS_ACCESS_KEY_ID=XXXXXXXX
export AWS_SECRET_ACCESS_KEY=XXXXXXXX
# or configure them in ~/.aws/credentials
export AWS_REGION=xx-yyyy-0
Formula is available at koudaiii/homebrew-tools.
$ brew tap koudaiii/pgdump-to-s3-go
$ brew install pgdump-to-s3-go
Precompiled binaries for Windows, OS X, Linux are available at Releases.
To install, use go get
:
$ go get -d github.com/koudaiii/pgdump-to-s3-go
$ cd $GOPATH/src/github.com/koudaiii/pgdump-to-s3-go
$ make deps
$ make install
docker image is available at quay.io/koudaiii/pgdump-to-s3-go.
# -t is required to colorize logs
$ docker run \
--rm \
-t \
-e AWS_ACCESS_KEY_ID=XXXXXXXX \
-e AWS_SECRET_ACCESS_KEY=XXXXXXXX \
-e AWS_REGION=xx-yyyy-0 \
quay.io/koudaiii/pgdump-to-s3-go:latest \
--db-url=postgresq://hoge:hoge@hoge:5432/dbname \
--s3-url=s3://hogehoge/dump/db.dump \
--dry-run
pgdump-to-s3-go --db-url=postgresq://hoge:hoge@hoge:5432/dbname --output s3://hogehoge/dump/db.dump
Uploaded!
s3://hogehoge/dump/db.dump
s3://hogehoge/dumps/db.dump.20180204_231110
--dry-run
pgdump-to-s3-go --db-url=postgresq://hoge:hoge@hoge:5432/dbname --output s3://hogehoge/dump/db.dump --dry-run
Upload URL
s3://hogehoge/dump/db.dump
s3://hogehoge/dumps/db.dump.20180204_231110
Option | Description | Required | Default |
---|---|---|---|
--help |
Print command line usage | ||
-v , --version |
Print version |
Clone this repository and build using make
.
$ go get -d github.com/koudaiii/pgdump-to-s3-go
$ cd $GOPATH/src/github.com/koudaiii/pgdump-to-s3-go
$ make
- Fork (https://github.com/koudaiii/pgdump-to-s3-go/fork)
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Run test suite with the
go test ./...
command and confirm that it passes - Run
gofmt -s
- Create a new Pull Request