There is no rule to follow, but I can't think of many royals who've published their life-stories before their fortieth birthday. The last King and Queen of Yugoslavia produced such works with the help of ghost writers when they were younger than Prince Harry, but at least the troubled couple's reign (if one can even call it a reign) was already a completed chapter and, unlike Harry, they saw their situation as teetering toward financial ruin.
“A King's Heritage” by King Peter II of Yugoslavia (1954, the year he turned 31)
“For a King's love” (also published as “For love of a King”) by Alexandra Queen of Yugoslavia (1956, the year she turned 35)