You actually cannot do it, but you could manage to accomplish similar outcomes.
Programmed death -- that's the easy part. You should read up on telomeres, they actually exist and apparently do provide programmed aging that sets a limit on lifespan. You can find a number of researchers that think telomeres are the primary cause of aging.
Telomerase can rebuild telomeres, but it is not normally active in most cells in humans and other animals. As you can imagine, this is an active area of research.
You still need to make yourself indestructible, which is impossible in a scientific, biology-based approach. If you heat any material to the point that it becomes a plasma, no biology of any conceivable type is possible. Even all of the conceivable advanced nanotech, force fields, and other magical technology can't save you if you are dropped into the sun. Surviving a nuclear explosion would be easy in comparison because the explosion does not last very long and with enough ablative shielding, you could be around long enough to die from the radiation.
If you are heated until water turns to steam, no person could survive. If you heated until proteins denature, you cannot survive -- this is also why cooking makes meat easier to chew -- the proteins are being unfolded and otherwise breaking down. As the article explains, this is already a serious problem with many proteins at 41 C / 105.8 F. Were this not so, a fever would not help to fight an infection. You could make similar observations for mechanical, chemical, and radioactive destruction of a person. Indestructibility is fundamentally impossible for many reasons.
You could increase trauma survival by the strategy of adding thicker layer of outer protection that can be destroyed and regrown without hurting the person; make it tough like scales. However, this comes at a heavy cost in terms of flexibility, weight, and it does not even make you more than a bit tougher. Bullets, fire, etc. will still hurt and kill you easily.
Might I suggest that instead of being indestructible, you could add more redundancy in critical organs and add a very effective regeneration capability so that you can regrow missing limbs and organs? Death by trauma would be possible, but infrequent. Redundancy and regeneration are clearly possible, as they exist in the real world in various degrees.
Redundancy is not a panacea, additional resources are needed to make it possible, and biologically speaking, counter-productive overall if the biological cost exceeds the advantage of surviving trauma. We have two kidneys, only one is required for normal function, but lost of one results in a shorter lifespan. Loss of one lung is survivable. Loss of one heart is a bigger problem.
A better strategy than having 2 of every critical organ, is distributed function, where the organ is distributed throughout the body. Bone marrow production of blood cells is an excellent example of distributed function, but it is only possible because the blood vessel network is already everywhere. A distributed kidney would require a network for urine collection -- there is very little room for additional networks within the body.
If you could also make external backups of your brain and genetic material, even death would be reversible via cloning and downloading your consciousness from a backup. Immortality would be a logical consequence of such. However, if you have legal and ethical strictures against it, it would only be available to criminal elements able to remain outside the bounds of the law. Unbound population growth would be a good reason for this to be illegal. As a controlled and complicated technology, you could perhaps enforce this legal restriction nearly all of the time.
I started thinking about being dropped into the sun if you were completely invulnerable. Seems like it would be unpleasant. The surface of the sun is actually a pretty good vacuum (about 1e-6 atm.) so you would fall a very long way until you reach neutral buoyancy, certainly many thousands of miles into the interior. At that depth, pressure would be over 1000 atm, insanely bright and hot. Little variation in conditions, though convection currents would move you around. Of course there would be nothing to eat, and nothing to do. You would be looking forward to your programmed death. Maybe, if you were lucky, you could go insane quickly and not have to suffer for many years.