It's more complicated, there are many variants. Some use a live weakened version of the virus/bacteria. Some use a dead versions. Some use only a small part of the surface of the virus/bacteria that is enough to be recognized. (The last is similar to the approach in this vaccine.)
[In some old vaccines, they used a somewhat related similar virus/bacteria that was close enough to make you get the immunity, but not to cause the illness. I'm not sure if this method is used still today.]
[In some old vaccines, they used a somewhat related similar virus/bacteria that was close enough to make you get the immunity, but not to cause the illness. I'm not sure if this method is used still today.]