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.
Two serving soldiers who threw sandbags from George IV Bridge in Edinburgh onto a street below have each been fined £2,400.