Bash script restore MongoDB and upload to S3
?
R
BashScript to download the tarball from S3 to a local machine and uncompress the mongo dump bson.
1#!/bin/sh
2set -e
3
4# AWS Config
5export AWS_ACCESS_KEY_ID="xxx"
6export AWS_SECRET_ACCESS_KEY="yyy"
7
8FILENAME="aaaa.tar.gz"
9OUTDIR="/tmp/"
10
11# Download
12aws s3 cp s3://my-mongo-backups/$FILENAME $OUTDIR$FILENAME
13
14# Uncompress
15tar -xzf $OUTDIR$FILENAMECreated on 5/23/2018