If you have shore power
, just install a 6 gallon (or 12 gallon if you have the room) hot water tank.
When I looked into this, none of the tankless manufacturers would certify for boat use. If you have a fire, the insur co will likely deny your claim. Furthermore, a surveyor
will probably mark it down and the insur co would insist on it's removal
before binding coverage.
If you find a unit acceptable to the yacht insurance
industry, please post it here. Perhaps things have changed in a few years