That's because of years of work in developing RNA sequencing technology and mRNA delivery technology. Once a virus was isolated and sequenced, they just had to pick a safe part of the exterior to make into a vaccine and them print out the mRNA corresponding to that bit of the exterior, the spike proteins IIRC.
Then whatever testing is needed to ensure that the vaccine doesn't make the disease worse (which has happened, thanks biology) or interoperate with bits of the human system that it isn't supposed to, and voila, the vaccine, the visible part of an amazing piece of technology,