Some are, some aren’t. Just wearing a khaki uniform does not make a person a hero. A private who has washed dishes for 8 months is not a hero.
You have to something heroic to be a hero – maybe be in combat, maybe save a life, fly a military jet, whatever. In other words, action, not identity, is what makes a hero.
Now, if you are asking whether the military as a vocation is morally acceptable and heroic, then I would look to society to answer that question. Society, since ancient times, has seen military/militia/armies as a societally necessary group to defend the “tribe” and thereby promote the survival of the group.
Society values the military as a necessary (and moral) group within the community. And if there heroes in the military, it follows that they have value to society.
So my answer to you is “based on societal mores, YES, soldiers can be heroes.”
Think back to VietNam days – mid 60s to mid-70s—soldiers were NOT considered heroes at that time by a lot of the population, as a result of a corrupt government and an ill-advised war. That viewpoint changed in the 90s with the Iraq War.