How to pg_dump an RDS Postgres database?

Step 1: Create a security group on AWS that has your computer's IP address white listed.

Step 2: Add that security group to the database instance you want to connect to.

Step 3: Run pg_dump. Make sure to specify your user name (thanks @LHWizard) with the -U command. In this case mine wasn't 'postgres', so I guess generally you'll have to look in aws to find it. Also make sure to specify your database's name: in some command line tools there's a -d switch for that, but if you check pg_dump's usage:

Usage:
  pg_dump [OPTION]... [DBNAME]

you can see that it's a formal argument. So the whole command (in my case) was:

pg_dump -h <public dns> -U <my username> -f dump.sql <name of my database>

Notice that specifying the port number wasn't necessary -- I think because port 5432 is THE port for postgres.