Measure rice and place in a bowl.
Wash them 3-4 times and soak in 2 cups water for 30 minutes.
In the base of the Instant Pot add ghee. Set mode to sauté and normal.
Once the ghee melts and the instant pot reads 'Hot', add the whole spices.
Let them cook for a few seconds and then add the sliced onions.
Mix well and let the onions cook till they are light brown and caramelized.
Remove the onions and set aside and in the leftover ghee sprinkle sugar.
Without mixing or stirring let the sugar cook for 4-5 minutes; till it caramelizes completely.
Then add water to stop the sugar from caramelizing further or burning.
Drain the soaked rice and add them to the Instant pot.
Add back the tempering and onions leaving some onions aside for topping. Also add salt.
Mix well and press 'cancel'. Then change the mode to Pressure Cook and time to 3 minutes. Let the rice cook under high pressure and once the Instant Pot beeps; let it stand for 5 minutes.
Then release the remaining pressure and open the lid.
Fluff with a fork and serve with Dhanshak or a curry of your choice.