Skip to content

Instantly share code, notes, and snippets.

@bekerov
Forked from robhudson/dumpdata_to_s3.sh
Created January 27, 2018 12:56
Show Gist options
  • Save bekerov/61f3bc2e81373c1082c0f100726951e4 to your computer and use it in GitHub Desktop.
Save bekerov/61f3bc2e81373c1082c0f100726951e4 to your computer and use it in GitHub Desktop.
One-liner for cron to backup a Django project to S3 using dumpdata
# Assumptions:
#
# Assumes boto is installed which comes with the s3put command
#
# Assumes your S3 keys are in ~/.boto in the form:
#
# [Credentials]
# aws_access_key_id = XXX
# aws_secret_access_key = XXX
#
/path/to/python /path/to/project/manage.py dumpdata [app1 app2 ...] | gzip > /tmp/dump.json.gz && /path/to/s3put -b [bucket-name] /tmp/dump.json.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment