A firewall is only as strict as its default. I set the defaults first and add the exceptions after.
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw default deny routed
Incoming and outgoing apply to traffic for the machine itself, while routed covers packets forwarded between interfaces. Deny for incoming and allow for outgoing is the usual setup. Set up an SSH rule before you enable ufw on a remote host, otherwise you cut off your own session. Switching outgoing to deny is possible but means every service needs an explicit rule, including DNS and updates.
Further reading: ufw manual page