First of all, pg_dump works perfectly with older version of the server. In such cases you will see lines like these:
-- Dumped from database version 9.6.6
-- Dumped by pg_dump version 10.1
Also, pg_dump version, say, 10.0 should work with server version 10.1 and higher in 10.* branch – so minor version should not be the issue. See this comment in pg_dump's source code: https://github.com/postgres/postgres/blob/REL_10_STABLE/src/bin/pg_dump/pg_dump.c#L668
/*
* We allow the server to be back to 8.0, and up to any minor release of
* our own major version. (See also version check in pg_dumpall.c.)
*/
In your case, the issue can be caused by one of these aspects:
- you downloaded not official pg_dump, you took it from one of Postgres companies, it can be modified somehow (notice addition "-1" in URL, so you use their version of pg_dump labeled as "10.1-1");
- you're working with modified (by AWS engineers) Postgres server;
- recently, versioning schema has been changed in the Postgres project, from 3-number versions to 2 numbers. This means, that some bugs in version detecting functions might be present since the changes are relatively new.
Anyway, the error message you provided saying that 10.1 and 10.1 do not match – this is is not normal at all. There is a definitely a bug, but it's not obvious where.
I would try the following steps.
1) Use official (community supported) pg_dump. On Ubuntu, you need just install "postgresql-client-10" using official packages:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y postgresql-client-10
2) If the previous step doesn't help, try contacting AWS support, asking them to double-check this issue.
3) Finally, try to reproduce the problem with vanilla Postgres installed on your Ubuntu machine and if it persists, it definitely needs to be reported as a bug https://www.postgresql.org/docs/10/static/bug-reporting.html