An apparatus, including a pump body having an internal shaft, and a piston disposed within the shaft and having a piston head that includes a first ferromagnetic element. The apparatus also includes a motor coupled to drive a reciprocal longitudinal motion of the piston within the shaft, and a pump chamber configured to be removably attached to the pump body and having a rigid wall defining a fluid inlet, a fluid outlet, and an aperture. The apparatus additionally includes a flexible diaphragm fixed across the aperture and having a second ferromagnetic element, which engages the first ferromagnetic element when the pump chamber is attached to the pump body so that the reciprocal longitudinal motion of the piston causes alternating stretching and contraction of the flexible diaphragm, thereby modifying a volume of the pump chamber.