Trying to find a book. One character is the last soldier in history. After a long period (thousands of years?) of peace and civilization, a planet has one guy - the last soldier - who lives alone in a scenic rural place (maybe by a lake or ocean) and is solely responsible for defense of the planet. He has immense skills and may be very old.
Events turn out that he must fight - he controls a vast fleet of space warships, futuristic weapons, etc. He fights with these, and I think wins.
It might be an Ian M. Banks Culture novel. If not, I think it dates from roughly the same era (maybe 1990-2010).