Shasta (IAST Śāstā) is the name of a Hindu deity in India. Shasta is a generic Sanskrit term for a teacher. The word Shasta was first used in the sense of a Hindu deity in South India during the 3rd century. He is identified with many deities like Aiyanar, Ayyappa and Kartikeya. According to Tamil literature, Shasta has eight important forms.
Shasta is a generic term that means "Teacher, Guide, Lord, Ruler" in Sanskrit. In South India, a number of deities are associated with Shasta. The Tamil song Shasta Varavu states that there are eight important incarnations and forms of Shasta. This is also present in the agamic work Dyana Ratnavali. The Ashta-Shasta (eight Shastas) are Aadhi Maha Shasta, Dharma Shasta (Ayyappan), Gnana Shasta, Kalyana Varadha Shasta, Sammohana Shasta, Santhana Prapti Shasta, Veda Shasta and Veera Shasta.Brahma Shasta is another term associated with Kartikeya.
In Tamil Nadu, Aiyanar is used as another name of the deity Shasta. The earliest reference to Aiynar-Shasta is from the Arcot district in Tamil Nadu. The stones are dated to the 3rd century C.E. They read "Ayanappa; a shrine to Cattan." This is followed by another inscription in Uraiyur near Tiruchirapalli which is dated to the 4th century C.E.
Literary references to Aiyanar-Cattan are found in Silappatikaram, a Tamil work dated to the 4th to 5th centuries C.E. The Tamil sangam classics Purananuru, Akananuru etc. refer to ayyanar and "cattan" in many poems. There are several numerous references to sasta in sangam works.Some Tamil inscriptions of sangam times and also of the later pallava and chola period coming in from various parts of the empire refer to him as sevugan and mahasasta. The hymns of some alwars like tirumangai alwar and nammalwar in temples like tirumogur near madurai refer to sasta. A Sanskrit work dated prior to the 7th century known as Brahmanda Purana mentions Shasta as harihara suta or son of Siva and Narayana (Vishnu). There are references in puranas that narrate as to how sasta during his tenure on earth long ago conducted discourses on vedas and vedantas to a galaxy of gods and sages. Later on the Saivite revivalist Appar sang about Shasta as the progeny of Shiva and tirumaal (Vishnu) in one of his Tevarams in the 7th century. The child saint tirugnanasambandar in one of his songs praises ayyanar as celibate god, invincible and terrible in warfare, taking his abode alongside bhootaganas of Lord Siva. The place sanctity and history document or sthalapuranam of tiruvanaikkaval, a saivite temple near trichy, which was first documented by sage kasyapa informs us that sasta once served lord sivan at that site and after being blessed with a vision was instructed by lord to take abode in the outer sanctorum. It says that sasta continues to worship lord during the day of tiruvadirai. Adi sankara also has referred to ayyanar in sivanandalahari in one verse . Some ancient hagiographies have accounted that sri sankara was a deivamsam(divine soul portion) of sree sasta(sevugan), the same way as tirugnana sambandar was a divine portion of skanda and sundarar a divine portion of alalasundarar.He is also known to have composed verses praising the deity but the same are not available to us as of today. From the Chola period (9th century C.E) onwards the popularity of Aiyanar-Shasta became even more pronounced as is attested by epigraphy and imagery.