This paper analyzes the optimal management of a pandemic (stay-at-home and vaccination policies) in a dynamic model. The optimal lockdown policies respond to the spread of the virus with significant restrictions to employment, followed by partial loosening before the peak of the epidemic. Upon the availability of a vaccine, the optimal vaccination policy has an almost bang-bang property, despite the loss of immunity of the vaccinated: vaccinate at the highest possible rate, and then rapidly converge to the steady state. The model illustrates interesting trade-offs as it implies that lower hospital capacity requires flattening the infection curve and hence a more stringent lockdown, but lower vaccination possibilities (both the likelihood of a vaccine and the vaccination rate) push the optimal lockdown policy in the opposite direction, even before the arrival of vaccine. The model implies that the “dollar” value of a vaccine decreases rapidly as time passes with the reinfection rate being an important determinant of the monetary value. The value that society assigns to averting deaths is a major driver of the optimal policy. The sensitivity analysis shows that even for reasonable bounds of the economic and epidemiological parameters, the timing and the magnitude of the optimal policy varies substantially.