Tim makes a good point. Although both Salerno and Amalfi docks are large and solid so weather won't affect that ferry quite as much as Positano for example, it could happen that ferry can't run.
Alternatives are the bus or a taxi which are readily available right there near dock/bus stops in Amalfi.
Bus schedule here- buy ticket at Tabachi right next to the bus area
https://www.positano.com/en/bus-schedule?route=amalfi_maiori_salerno#section-schedule-result
We stayed 2 nights in Salerno after our time in Amalfi and enjoyed it very much. If you have a night to spare you might consider heading to Salerno early in am- drop your bags at hotel then easy/quick/cheap train to Paestum to see the amazing Greek temples. It was a worthwhile diversion and Salerno is a nice little town with few tourists and less expensive lodging than Amalfi. Catch your train to Rome the following morning.
We stayed here- it was a great location and perfectly fine for a 2 night stay.
https://montestella1914.it
Do a few searches here "Salerno" and "Paestum" for more info.
Lastly for a definite transfer you can book ahead and not worry about weather or timing- probably around 100 euros (taxi would be about the same)
https://www.topexcursionsorrento.com/?portal_referer_id=46