voltage regulators: How does Ohm's law apply here (and how not to fry an ams1117)
First, you do not say what you were using as a load or how much current you were drawing.
Second Ohm's law DOES NOT apply here. I mean, you could imagine the linear regulator as a variable resistor that continuously adjusts itself based on the combination of input voltage, output voltage, and instantaneous current to drop exactly the correct amount of voltage across itself to keep the output voltage the same, but it is kind of useless. So don't do it. It has too many modifications and stipulations to be useful.
Trying to think of a linear regulator as a resistor is a bit trying to think of a round wheel as a square where the distance between the center of the wheel and the ground constantly adjusts to maintain the same distance as it rolls.
Linear regulators burn off all the extra voltage as heat. That means:

the input voltage must always be higher than the output voltage,
the input current is the same as the output current,
and the higher the input voltage relative to the output voltage the
more heat is made.

So in your example, 5V in and 2.5V out would be 2.5V difference. Suppose you were drawing just 250mA (you never told us what your load was or how much current you were pulling), then the power dissipated would be:
(5V - 2.5V) * 250mA = 625mW
In the AMS1117 datasheet, the largest package available is listed as heating up 80C/W. So it would heatup 50C above ambient. That's hot. And that's with the largest package. The smallest package heats up 160C/W which is 100C above ambient.