IMPORTANT: This is a fork of snic/mongorestore-s3 which is a fork of Drivetech/mongorestore-s3
Docker Image with Alpine Linux, mongorestore and awscli for restore mongo backup from s3
Restore complete database from backup 2016-09-20_06-00-00_UTC.gz in s3
docker run -d --name mongorestore \
-v /tmp/backup:/backup
-e "BACKUP_NAMES=2016-09-20_06-00-00_UTC.gz"
-e "MONGO_URI=mongodb://user:pass@host:port/dbname"
-e "AWS_ACCESS_KEY_ID=your_aws_access_key"
-e "AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key"
-e "AWS_DEFAULT_REGION=us-west-1"
-e "S3_BUCKET=your_aws_bucket"
atlascloud/mongorestore-s3
Restore only collections collection1 and collection2 from backup 2016-09-20_06-00-00_UTC.gz in s3
docker run -d --name mongorestore \
-v /tmp/backup:/backup
-e "BACKUP_NAMES=2016-09-20_06-00-00_UTC.gz"
-e "MONGO_URI=mongodb://user:pass@host:port/dbname"
-e "AWS_ACCESS_KEY_ID=your_aws_access_key"
-e "AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key"
-e "AWS_DEFAULT_REGION=us-west-1"
-e "S3_BUCKET=your_aws_bucket"
-e "COLLECTIONS=collection1,collection2"
atlascloud/mongorestore-s3
Restore complete database from backup 2016-09-20_06-00-00_UTC.gz in s3 with "--noIndexRestore"
docker run -d --name mongorestore \
-v /tmp/backup:/backup
-e "BACKUP_NAMES=2016-09-20_06-00-00_UTC.gz"
-e "MONGO_URI=mongodb://user:pass@host:port/dbname"
-e "AWS_ACCESS_KEY_ID=your_aws_access_key"
-e "AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key"
-e "AWS_DEFAULT_REGION=us-west-1"
-e "S3_BUCKET=your_aws_bucket"
-e EXTRA="--noIndexRestore"
atlascloud/mongorestore-s3
- Customize the file kub "kub_cronjob.yaml" for his needs.
- Run
kubectl apply -f ./kub_cronjob.yaml
in the repository directory. - done 🙂
You need to add a user with the following policies. Be sure to change your_bucket
by the correct.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1412062044000",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::your_bucket/*"
]
},
{
"Sid": "Stmt1412062128000",
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::your_bucket"
]
}
]
}
S3_PATH
- Default value ismongodb
. Examples3://your_bucket/mongodb/
EXTRA
- Default not set. Set extra parameters that are passed to mongorestoreBACKUP_PATH
- Local path inside/backup
where the backups are located. Useful for tar files with some directory structure