Installing Home Assistant on a RPi 4b with SSD boot

Steps to reduce Write Cycles and extend SD/SSD life expectancy - Community Guides - Home Assistant Community (home-assistant.io)

You can find all the steps over there. Simply adding db_url: 'sqlite:///:memory:' to recorder section in the configuration file will move the database to RAM.