Transfer of data (lots) from NAS based MariaDB to Postgres at AWS
Trying to do a fast and reliable insert over an intermittent connection will be a headache. I would:


Use something like rsync with compression to get your endpoint files up to a centralized, reliable server.
Once you believe the files are good, do a bulk load from that centralized location to the DB. You could then use the COPY command, a flat file foreign table wrapper, or get fancier with an ETL tool.