Ejaculation by a means other than coitus (entering the penis in the vagina\anus) comes under the ruling of masturbation. This applies to masturbation of oneself or by means of another person (such as the various types of non-penetrative sex).
You need to do the following:
Tawbah: Masturbating during Ramadan is haram. You should feel shame and remorse and should correct your behavior in the future. If it is unavoidable then limit it to the night time, there can be no excuse for doing it during the fasting hours.
Ghusl: It creates ritual impurity and requires taking a bath. This is essential before you can perform the daily prayers etc.
Qada: It breaks the fast making it invalid. Hence you are required to repeat that fast after Ramadan.
Imsak: While it broke the fast, you are still expected to refrain from food, drink and sexual pleasure for the rest of the day, in respect of Ramadan.
Kaffarah: Whether breaking the fast by masturbation requires Kaffarah is disagreed upon. According to the Hanafis, Shafi'is and Hanbalis it does not require Kaffarah. While according to the Malikis and one saying of the Hanbalis it requires Kaffarah. The Kaffarah of breaking a fast (if it is applicable) is to free a slave, or to fast consecutively for 60 days, or to feed 60 people for a day.
تعمد إنزال المني بلا جماع، وذلك كالاستمناء بالكف أو بالتبطين والتفخيذ، أو باللمس والتقبيل ونحوهما فإنه يوجب القضاء دون الكفارة عند جمهور الفقهاء - الحنفية والشافعية والحنابلة - وعند المالكية يوجب القضاء والكفارة معا
— Mawsoo‘ah al-Fiqhiyyah