You can buy tickets at the train station once you're in Sri Lanka, but as some trains get very busy, we highly recommend booking online here in advance if you're travelling during high season, and especially for the Kandy - Ella tea train.