title: How to use pg_restore with AWS RDS correctly to restore postgresql database
body: <p>I am trying to restore my Postgresql database to AWS RDS. I think I am almost there. I can get a dump, and recreate the db locally, but I am missing the last step to restore it to AWS RDS. </p>
  
  <p>Here is what I am doing: </p>
  
  <ol>
  <li>I get my dump</li>
  </ol>
  
  <p><code>$ pg_dump -h my_public dns -U myusername -f dump.sql myawsdb</code></p>
  
  <ol start="2">
  <li>I create a local db in my shell called test: </li>
  </ol>
  
  <p><code>create database test;</code></p>
  
  <ol start="3">
  <li>I put the dump into my test db</li>
  </ol>
  
  <p><code>$ psql -U myusername -d test -f dump.sql</code></p>
  
  <p>so far so good. </p>
  
  <p><code>I get an error: psql:dump.sql:2705: ERROR:  role "rdsadmin" does not exist</code>, but I think I can ignore it, because my db is there with all the content. (I checked with \list and \connect test).</p>
  
  <p>Now I want to restore this dump/test to my AWS RDS. </p>
  
  <p>Following this <a href="https://gist.github.com/syafiqfaiz/5273cd41df6f08fdedeb96e12af70e3b" rel="noreferrer">https://gist.github.com/syafiqfaiz/5273cd41df6f08fdedeb96e12af70e3b</a> 
  I now should do: </p>
  
  <p><code>pg_restore -h &lt;host&gt; -U &lt;username&gt; -c -d &lt;database name&gt; &lt;filename to be restored&gt;</code></p>
  
  <p>But what is my filename and what is my database name?</p>
  
  <p>I tried: </p>
  
  <p><code>pg_restore -h mydns -U myusername -c -d myawsdbname test</code>
  <code>pg_restore -h mydns -U myusername -c -d myawsdbname dump.sql</code></p>
  
  <p>and a couple of more options that I don't recall. </p>
  
  <p>Most of the times it tells me something like: <code>pg_restore: [archiver] could not open input file "test.dump": No such file or directory</code></p>
  
  <p>Or, for the second: <code>input file appears to be a text format dump. Please use psql.</code></p>
  
  <p>Can somone point me into the right direction? Help is very much appreciated!</p>
  
  <p>EDIT: So I created a .dump file using <code>$ pg_dump -Fc mydb &gt; db.dump</code>
  Using this file I think it works. Now I get the error <code>[archiver (db)] could not execute query: ERROR:  role "myuser" does not exist
      Command was: ALTER TABLE public.users_user_user_permissions_id_seq OWNER TO micromegas;</code></p>
  
  <p>Can I ingore that?</p>
  
  <p>EDIT2: I got rid of the error adding the flags--no-owner --role=mypguser --no-privileges --no-owner</p>