Cusco is the famous Incan capital and gateway to the sights of the Sacred Valley, including world-famous Machu Picchu. As one of the destinations closest to Machu Picchu that is accessible by both road and rail, Ollantaytambo is often where travelers journey to in order to take the train to both Aguas Calientes and Machu Picchu.
From Cusco, you can make the 45-mile (72 km) journey to Ollantaytambo by train, private transfer, or bus. Taking the train is by far the most atmospheric option, and also the most expensive—though especially worth it if you're continuing the train journey to Machu Picchu.
Duration: 1.5-2.5 hours
It may be one of the most expensive journeys per mile in the world, but its absolutely the most atmospheric way of getting between Cusco and Ollantaytambo.
Inca Rail and Peru Rail each run three to four daily services to Aguas Calientes which stop at Ollantaytambo. All of these services call at or originate at Cusco's Poroy station, a 20-minute drive from central Cusco. Some of these services now actually begin at Cusco's historic San Pedro station, closer to central Cusco, which makes the journey longer and the upper duration given above.
One catch: it isn't possible to buy a ticket from Cusco to Ollantaytambo on the train company websites, and it can also be difficult to buy a ticket at the train stations in Cusco that is just to Ollantaytambo (you may be charged the full fare through to Aguas Calientes). This is because trains here are running on the assumption most travelers will want to go straight to Machu Picchu from Cusco.
See this article for more on train travel in Peru.
By Private Transfer
Duration: 1.5-2.5 hours
This is the quickest and the second-most expensive option for travel between these two destinations. A great deal of international travelers arrive into Cusco, so organizing a private transfer to Ollantaytambo and/or other Sacred Valley sights, for a day or even several days, is quite common. It is also very convenient, as there is plenty to see, as well as of course being safer and more reliable for early morning departures.
The route from Cusco via Urubamba and Chinchero is quickest, and can be done in 1.5 hours. Via Pisac, the journey is longer and closer to 2.5 hours.
By Bus or Colectivo
Duration: 2-3 hours
There are two minibus routes from Cusco, each departing from a different location. At Puente Grau, minibuses leave via Chinchero for Urubamba, the fastest route (one hour). At Puputi, minibuses leave for the longer journey to Urubamba via Pisac (1.5 to two hours). The journey is popular despite being longer as many travelers want to stop at Pisac first.
Departures on both routes are at least hourly throughout daylight hours, but have no fixed schedule because they like to get as many passengers as possible before leaving. In Urubamba, further buses and other vehicles are available for the 30-minute run to Ollantaytambo.
Direct buses to Ollantaytambo from Cusco are harder to come by, and you may end up waiting far longer for one. However, from Puente Grau there are less-frequent colectivos (shared taxis, that leave when full with four passengers) that do journey the whole way to Ollantaytambo from Cusco. These run on demand, and so sometimes they will wait in Urubamba for more passengers even if they say in Cusco that they run direct to Ollantaytambo.