It depends on where you're located. In some places replacing a water heater would require a permit to be pulled and in others no permit would be required.
Although I'm sure you could replace the water heater anyway without anyone knowing you did so without a permit.
In my location we require permits to replace anything major like a water heater or furnace. But a friend of mine replaced his water heater himself without getting a permit and nobody said anything.