Recording an acoustic piano, especially an upright, is a challenge. I have had decent results using old fashioned tape (cassette and reel) and having a mic in the piano and another a few feet away.
For electronic instruments a digital interface into a computer works well. There are some relatively cheap USB connectors for about $30, and I spent about 3 times that for a decent low end M-Audio interface.
With electric instruments you have to be careful that you are getting a strong enough signal - you might need to have an amplifier in line to boost the signal.