From the CDC:
COVID-19 vaccination causes a more predictable immune response than infection with the virus that causes COVID-19.
Getting a COVID-19 vaccine gives most people a high level of protection against COVID-19 and can provide added protection for people who already had COVID-19. One study showed that, for people who already had COVID-19, those who do not get vaccinated after their recovery are more than 2 times as likely to get COVID-19 again than those who get fully vaccinated after their recovery.
All COVID-19 vaccines currently available in the United States are effective at preventing COVID-19. Getting sick with COVID-19 can offer some protection from future illness, sometimes called “natural immunity,” but the
level of protection people get from having COVID-19 may vary depending on how mild or severe their illness was, the time since their infection, and their age.
From HHS:
Fully vaccinated people are protected from serious COVID illness and hospitalizations in the majority of cases, including from COVID variants.