Karl Wainwright, 26, of The Black Watch and 22-year old Ben Peters of the Royal Dragoon Guards had been out celebrating the end of a training course.
The men had previously admitted throwing the sandbags into Merchant Street at 03:00 on 21 January 2016.
Sentence had been deferred for background reports.
Sheriff Kenneth Maciver, at the city's sheriff court, told the men: "Unfortunately, this is not an uncommon occurrence. In fact, too many people throw things over this bridge.
"A few years ago a young woman was seriously injured. It is a highly dangerous activity. It is absolutely obvious you could not predict where the sandbags would land."
Wainwright's solicitor, Mark Hutchison, told Sheriff Maciver there had been four men on a night out after completing a training course and too much drink had been taken. "It was an isolated incident of extreme stupidity," he said.
Charles Morrison, appearing for Peters, also described his client's actions as "extremely stupid and dangerous". Both men, it was said, were regretful for their actions.
CCTV footage showed Wainwright and Peters taking a cursory glance over the bridge, collecting the sandbags from the road and hurling them over without looking to see if there was anyone there.
Sentencing the men, Sheriff Maciver said: "It is extremely disappointing to see two members of our Armed Forces here in court, facing a custodial sentence, for what I describe as stupid and dangerous behaviour in the city centre of Edinburgh when you were both extremely drunk.
"It simply does not bear thinking about what that could do to someone if it had landed on their heads."
He added that, in different circumstances, he would have imposed a custodial sentence.
But, as neither man had any previous convictions and had good reports from their regiments, he would not and allow their regiments to deal with the matter.

The Dow Jones hit a new record high closing up 24.45 points to 18,372.12.
The S&P 500 climbed just 0.29 points to 2,152.43, while the tech-heavy Nasdaq index slipped 17.09 to 5,005.73.
Investors remained cautious ahead of the corporate earnings season, with major firms due to release results over the next few weeks, starting with JP Morgan on Thursday.
Shares in JP Morgan Chase slipped 0.2%.
Delta Airlines which also reports quarterly results on Thursday closed 1.5% lower.
Health insurance providers saw a rise in their share price after a report said healthcare spending in the US would rise by 5.8% per year over the next decade.
Insurance provider Humana gained 4.3%, while Aetna climbed 3.2%.
Shares of Juno Therapeutics added 9.5% despite a lawsuit that was filed against it this week.
The lawsuit alleges that Juno and its chief executive Hans Bishop misled investors about the death of a patient in a drug trial.
Global oil prices fell by 4%. Brent crude oil dropped to $46.48 per barrel and West Texas crude slipped to $45 per barrel.
Two serving soldiers who threw sandbags from George IV Bridge in Edinburgh onto a street below have each been fined £2,400.
[NEXT_CONCEPT]
(Closed): Wall Street finished with mixed results as a three-day rally showed signs of slowing.