Life, according to philosopher Ayn Rand, is “a process of self-sustaining and self-generated action.” 
Unlike inanimate objects (rocks, planets, atoms), a living entity must engage in actions to sustain itself, in order to exist as a living being (as opposed to a corpse).
If one wishes to live, then one must choose to take those actions necessary to obtain the values (air, food, water, housing, medicine, transport, etc.) to sustain one’s existence, else one will die.
Unlike other organisms — bacteria, elephants or apes which act by instinct — humans beings have no automatic knowledge and must discover the principles, or virtues, needed to survive.
Human beings require a moral code.