Apple does not allow renting Macs less than 24 hours.
Edit: I don't think you're right. I've checked the Scaleway console and it appears the minimum unit of billing for this is one hour. I'd check, but they're out of stock.
Second edit: I missed the part where it says 24 hour minimum period on the instance setup page:
"As required by Apple License, you must keep this instance at least 24 hours. You will be able to delete it only after 24 hours."
[1] https://www.apple.com/legal/sla/docs/macOSBigSur.pdf
Edit: It seems that before BigSur the legallity of subleasing macOS was a "gray area". I guess as long as it doesn't hurt Apple they didn't come after you.