A drive unit, comprising: a motor; an inverter that drives the motor; a first electric storage device; a step up-down converter having a switching element and a reactor, the step up-down converter being connected to a first electric power line and a second electric power line, the first electric power line being connected to the inverter, the second electric power line being connected to the first electric storage device, the step up-down converter being configured to exchange electric power between the second electric power line and the first electric power line while converting voltage of the electric power; a first capacitor attached to the first electric power line; a second capacitor attached to the second electric power line; a DC-DC converter connected to the first electric power line; a relay provided in a portion of the second electric power line closer to the first electric storage device than the second capacitor; and an electronic control unit configured to control the step up-down converter and the DC-DC converter, the drive unit being characterized in that the electronic control unit is configured to execute a first discharge control when the relay is turned off to discharge a charge of the first capacitor and the second capacitor, the first discharge control being a control to drive the DC-DC converter, while setting a target duty ratio of the step up-down converter such that a total energy loss produced in the step up-down converter and the DC-DC converter becomes greater than a maximum value of energy loss produced in the step up-down converter, and controlling the step up-down converter, wherein the electronic control unit is configured to store a predetermined relation between voltage of the second electric power line and the target duty ratio that maximizes the total energy loss produced in the step up-down converter and the DC-DC converter, and the electronic control unit is configured to set the target duty ratio by applying the voltage of the second electric power line to the relation when the first discharge control is executed. a motor; an inverter that drives the motor; a first electric storage device; a step up-down converter having a switching element and a reactor, the step up-down converter being connected to a first electric power line and a second electric power line, the first electric power line being connected to the inverter, the second electric power line being connected to the first electric storage device, the step up-down converter being configured to exchange electric power between the second electric power line and the first electric power line while converting voltage of the electric power; a first capacitor attached to the first electric power line; a second capacitor attached to the second electric power line; a DC-DC converter connected to the first electric power line; a relay provided in a portion of the second electric power line closer to the first electric storage device than the second capacitor; and an electronic control unit configured to control the step up-down converter and the DC-DC converter, the drive unit being characterized in that the electronic control unit is configured to execute a first discharge control when the relay is turned off to discharge a charge of the first capacitor and the second capacitor, the first discharge control being a control to drive the DC-DC converter, while setting a target duty ratio of the step up-down converter such that a total energy loss produced in the step up-down converter and the DC-DC converter becomes greater than a maximum value of energy loss produced in the step up-down converter, and controlling the step up-down converter, the electronic control unit is configured to store a predetermined relation between voltage of the second electric power line and the target duty ratio that maximizes the total energy loss produced in the step up-down converter and the DC-DC converter, and the electronic control unit is configured to set the target duty ratio by applying the voltage of the second electric power line to the relation when the first discharge control is executed.