Pimple or cold sore

This appeared out of nowhere. It looked like this when I woke up. It is hard and it hurts if I touch it. Also red and swollen around that area.