It was rocking like a boat. What kind of figurative language is this? What is the author trying to say?

This is a simile, as it compares the rocking motion to that of a boat. The author is trying to convey the idea that the object being described is moving back and forth with a similar motion to how a boat rocks on the water.