Search code examples
amazon-web-servicesamazon-rdsrds

Upload a local CSV to a Remote Postgre (AWS)


I'm facing the following problem: I have an instance (RDS) on AWS to store some data, and I want to upload some data from my local pc to it! Using PgAdmin it seemed such an easy task, but I have to be a superuser in order to use the command 'COPY' that everywhere in the internet says!

Sadly, for security reasons AWS blocks you from having those kinds of permissions, which is making my task difficult.

I'm looking to see if anyone can come up with any solution, as getting the file to the same instance the database is running is impossible to me.

Thank you!


Solution

  • The official AWS RDS documentation covers this. Read the \copy command section at the bottom of the page.

    You can run the \copy command from the psql prompt to import data into a table on a PostgreSQL DB instance.

    target-db=> \copy source-table from 'source-table.csv' with DELIMITER ',';