Slice the red onion into 1/8th inch thin slices. Set them aside.
Add water, vinegar, salt and sugar to a saucepan.
Place the saucepan on the stove and bring it to a simmer. Once you see tiny bubbles, that means it is done. Don't boil this water.
Place the saucepan on a heatproof mat.
Take the desired glass jar. Start placing the onions and green chilies in the jar.
Press the onions down properly. Pour the mixture slowly.
Press the onions down again to make sure they are submerged in vinegar water.
Now close the lid and place them in the refrigerator for upto two hours before serving.
Store the pickled onions in the refrigerator for upto 10 days.