This paper determines the optimal timing of dike heightenings as well as the corresponding optimal dike heightenings to protect against floods. To derive the optimal policy, we design an algorithm based on the Impulse Control Maximum Principle. In this way, this paper presents one of the first real-life applications of the Impulse Control Maximum Principle developed by Blaquière. We show that the proposed impulse control (IC) approach performs better than dynamic programming with respect to computational time. This is caused by the fact that IC does not need discretization in time.