The article describes the design and optimization of operation of an electric bus powered by the hydrogen fuel cells. At the beginning, an approach to design of a 12-meter urban bus, powered by hydrogen, is presented, as well as examples of components for its construction. Next, the problem of selecting the size of traction batteries and stacks of the Proton Exchange Membrane (PEM) hydrogen fuel cells was discussed. These are the key components affecting the price of the bus and should be subject to optimization. The results of optimization of the size of traction batteries and the fuel cell system for a bus traveling in inter-city traffic are presented. The optimization was based on data from the literature and data from the monitoring system of actual hydrogen powered buses located on the Internet platform. The main purpose of the research, which was to determine the total costs of ownership (TCO), is presented as well.