Skip to content

Instantly share code, notes, and snippets.

@nabucosound
Last active December 16, 2015 07:18
Show Gist options
  • Save nabucosound/5397255 to your computer and use it in GitHub Desktop.
Save nabucosound/5397255 to your computer and use it in GitHub Desktop.
Cheatsheets!

Amazon AWS Cheatsheet

Made by Nabuco (http://nomadblue.com/).

Note: Substitute [params] with the proper values.

Put dump file into S3 bucket using cmd from Boto (pip install boto):

# WARNING: s3put cmd must be run from the same folder as latest.pgdump
# WARNING: remember to give the S3 bucket public permission to open/download the db from Heroku

s3put -a [AWS_ACCESS_KEY_ID] -s [AWS_SECRET_ACCESS_KEY] -b [bucketname] -p [file full path to strip] -k [full path in bucket to append] [filename]

# EXAMPLE: Upload "latest.pgdump" to a "backups" folder in "mybucket" bucket

s3put -a 444AB5J44POB8TYJ438Q -s lJ43vs3HXS8Kx3C2IN3h3FSVQIK33egJ/J92S333 -b mybucket -p `pwd` -k backups/staging latest.pgdump

Restore a local pg backup to heroku app:

heroku pgbackups:restore [HEROKU_DATABASE_NAME] 'https://[bucketname].s3.amazonaws.com/[full path in bucket]/latest.pgdump' -a [heroku app name]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment