The crew had been called to an incident in Musselburgh at around 1.30am on Sunday.
As the ambulance travelled along the High Street, a brick hit the vehicle inches above the driver’s side window, causing a dent.
The crew, who both escaped injury, stopped and called police while another ambulance was dispatched to the call.
A spokesman for the ambulance service said: “Assaults of any kind on staff are totally unacceptable and this incident could have resulted in critical injuries to everyone in the vehicle.”
Lothian and Borders Police said they were investigating the incident.