We consider a shape optimization problem for a cantilevered pipe conveying fluid. The pipe is controlled actively by LQG controller which is synthesized for a mathematical model of the pipe system in a specified flow velocity. The outer diameter distribution of the pipe and the location of the sensor and the actuator are optimized such that the critical flow velocity of the closed-loop system is maximized. The outer diameter distribution is optimized such that the total volume of the pipe is nuchanged with the initial diameter distribution. This optimal design problem results in a maximization problem with an equality constraint. Since the critical flow velocity of the closed-loop system may not be continuous for each design parameter, we can not utilize a gradient information of the objective function. In this paper, we use SA(simulated annealing)method which is known as one of discrete optimization techniques.