On that point, did you try actually looking around yourself for real-life examples of osm2pgsql lua scripts, starting with for example the defaults that ship with it, or the examples bundled with a commonly-used map style such as OSM Carto?
What about looking for examples that fillet only the data that you want out of the planel file before even trying to load it?
As a completely different approach, why not generate the database (including removing all information that you don’t want) on a large machine and then just copying it to a small one? I don’t mean “mess about with port forwarding” here, I mean conclude the import (and removal of what you don’t want locally) and then copying and importing it on the small one.