The astronaut should shoot the aerosol spray in the opposite direction of where the astronaut is going to return back to the spaceship. This is in accordance to Newton’s Thrid Law, every action has an equal and opposite reaction.
Hope this helps you out!