Vaccination is
artificially acquiredactive immunity(b) The goal of vaccination is to primehumoral and cellular immune responses against pathogens (or their toxins) without simultaneously causing disease
(c) Typically vaccines are most easily developed against either toxins or against pathogens that, upon infection, induce lifetime immunity (i.e., naturally acquired active immunity) in their hosts
(d) Pathogens for which even infection accompanied by disease does not result in immunity (particularly diseases that cause gastrointestinal distress) are not easy to prevent by the application of vaccination (note that the polio vaccines are seemingly exceptions but instead do not prevent the gastrointestinal ailment so much as systemic infection by the virus)
(e) Note that most vaccines do not prevent infection (i.e., growth of the pathogen) so much as the disease that results from infection; this is accomplished either by blocking the effects of pathogen toxins or by priming the immune system against the pathogen such that infection is brought under control much more quickly, before full-blown disease results
(f) Vaccines do not necessarily confer life-long immunity; the duration of immunity typically is dependent on to what degree the vaccination mimics a natural infection plus to what degree subsequent natural infections are capable of boosting the immunization
Typically vaccines are employed to prevent disease though not as a means of treating existing infections; exceptional is the rabies vaccines which is employed, in humans, to prevent the development of disease given infection