I have a folder of rasters that updates daily that I load into a PostgreSQL database using the raster2pgsql command line tool. I want to make this database outward facing so that I can connect to it. I like the idea of storing this database on AWS, but I don't know if it's possible to

  1. Add rasters directly to the AWS PostgreSQL database, or
  2. Sync my on-prem database with the database on AWS.

I really would like to avoid having to re-import the entire database daily as I only need to keep adding one raster per day. Is this possible (and how would I go about doing this?) or is there a better tool for doing this?

  • Just to clarify, you're storing your rasters in the database versus the external storage option? – DPSSpatial Sep 2 '20 at 15:50
  • @DPSSpatial correct, I'm not currently aware of a way to directly load rasters into external storage – JWB Sep 2 '20 at 16:00
  • OK Thanks - would a SQL dump work on rasters as well? – DPSSpatial Sep 2 '20 at 16:04
  • Is it possible to only dump part of a database? – JWB Sep 2 '20 at 16:14
  • Yes - but will it work on a raster? stackoverflow.com/a/3682944/1704448 – DPSSpatial Sep 2 '20 at 16:20

I would use pg_dump and specify a single table to export:

pg_dump --host localhost --port 5432 --username postgres --format plain --verbose --file "<abstract_file_path>" --table public.tablename dbname

From there, pg_restore can be used to upload that table to your AWS server.

More info here: https://stackoverflow.com/questions/3682866/how-to-create-a-backup-of-a-single-table-in-a-postgres-database/3682944#3682944

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.