Video of the rat shot by an 11th-grader quickly spread on social media among students at Atlantic Community High school in Delray Beach.
In the video aired by news station WPTV, the brown rat appears as large as a snack-size bag of chips.
A Palm Beach County Schools statement says the vending machine was quickly locked Tuesday to keep students from using it.
The district says the vending machine company was alerted and an exterminator was called to the school.
Student Kael Williams said the incident was particularly disgusting because students eat from that machine throughout the day.
Information from: WPTV-TV, http://www.tcpalm.com/tcp/wptv