This paper is concerned about recovering the observability of cyber-physical power grids after massive cyber attacks, which helps to achieve the cyber-physical resilience of the grids. For recovering the observability of the grid, the measurability of the Phasor Measurement Units (PMUs) and the connectivity of the communication network are needed to be restored. The PMU and communication infrastructure restorations are jointly formulated as a Mixed Integer Linear Programming (MILP) problem to minimize the observability loss of the grid over time after a cyber attack while considering the constraint of limited resources. The efficacy of the proposed optimal restoration strategy is verified by comparing with heuristic methods on the IEEE 57-bus system.