It could also be some other book in the Dragonback series.
This is a book about a boy who acquires a dragon-like alien that can become a tattoo.
As the rest of his body reached Polphir’s, each part altered from
three-dimensional to two-dimensional form as it flowed onto his host’s
body. A split second later the transformation was complete, leaving
Draycos stretched like a living tattoo across Polphir’s back and legs
Indeed, the dragon will die if it is too long away from a host:
“After six hours had passed, I would die,” Draycos said softly “But I
am a warrior of the K’da. I will not force myself upon you if you do
not wish it.
Incidentally, this also demonstrates that Draycos lives by a code, as mentioned in the question.
Jack was his host, and there was a high debt of honor between a K’da
warrior and his host.